code cleanup; also noted potential memory issue in comment
authorDan Breslau <dbreslau@painless-security.com>
Fri, 28 Oct 2016 20:48:18 +0000 (16:48 -0400)
committerDan Breslau <dbreslau@painless-security.com>
Fri, 28 Oct 2016 20:48:18 +0000 (16:48 -0400)
mech_eap/display_status.c

index ef28e76..eefcd60 100644 (file)
@@ -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 */
 }