Hello,

cppcheck reports that buf is leaked at utils.c:2735. After some code review it looks it is right and the same bug is there on linux too.

It happens only once at startup time so no big deal but still.

Checked that uwsgicc still loads fine after the patch, cannot test other platforms. Please review.

thanks,
riccardo
diff -r 2f5831450427 utils.c
--- a/utils.c	Wed Aug 03 15:07:15 2011 +0200
+++ b/utils.c	Wed Aug 03 15:36:24 2011 +0200
@@ -2693,6 +2693,7 @@
 	if (len > 0) {
 		return buf;
 	}
+	free(buf);
 #elif defined(__APPLE__)
 	char *buf = uwsgi_malloc(uwsgi.page_size);
 	uint32_t len = uwsgi.page_size;
@@ -2715,9 +2716,11 @@
 		}
 		char *newbuf = realpath(buf, NULL);
 		if (newbuf) {
-			return newbuf;	
+			free(buf);
+			return newbuf;
 		}
-	}	
+		free(buf);
+	}
 #elif defined(__FreeBSD__)
 	char *buf = uwsgi_malloc(uwsgi.page_size);
 	size_t len = uwsgi.page_size;
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to