[libfko] minor memory leak fix for user detection (corner case)
authorMichael Rash <mbr@cipherdyne.org>
Mon, 30 Jul 2012 01:31:44 +0000 (21:31 -0400)
committerMichael Rash <mbr@cipherdyne.org>
Mon, 30 Jul 2012 01:31:44 +0000 (21:31 -0400)
lib/fko_user.c

index 37756b3..9c2a5ed 100644 (file)
@@ -74,7 +74,11 @@ fko_set_username(fko_ctx_t ctx, const char *spoof_user)
             /* if we still didn't get a username, fall back
             */
             if((username = getenv("USER")) == NULL)
+            {
                 username = strdup("NO_USER");
+                if(username == NULL)
+                    return(FKO_ERROR_MEMORY_ALLOCATION);
+            }
         }
     }