From: Dan Breslau Date: Fri, 28 Oct 2016 20:48:18 +0000 (-0400) Subject: code cleanup; also noted potential memory issue in comment X-Git-Tag: v1.0.0~5 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=mech_eap.git;a=commitdiff_plain;h=16c2635db63c0815d3064ef24d501acdc2d21617 code cleanup; also noted potential memory issue in comment --- diff --git a/mech_eap/display_status.c b/mech_eap/display_status.c index ef28e76..eefcd60 100644 --- a/mech_eap/display_status.c +++ b/mech_eap/display_status.c @@ -137,13 +137,18 @@ gssEapSaveStatusInfo(OM_uint32 minor, const char *format, ...) if (format != NULL) { va_start(ap, format); n = vasprintf(&s, format, ap); - if (n == -1) + if (n == -1) { + if (s) { + free(s); + } s = NULL; + } va_end(ap); - if (n == -1) - s = NULL; } - + /* NOTE: saveStatusInfoNoCopy apparently expects the string to be allocated with + * GSSAPI_MALLOC, so perhaps we should copy the string via gssalloc_strdup or + * equivalent? + */ saveStatusInfoNoCopy(minor, s); #endif /* WIN32 */ }