XQuartz: Silence a clang static analysis warning about a possible memory leak on exit

stub.c:356:9: warning: Potential leak of memory pointed to by 'newargv'
        asl_log(aslc, NULL, ASL_LEVEL_ERR,
        ^~~~~~~
stub.c:356:9: warning: Potential leak of memory pointed to by 'newenvp'
        asl_log(aslc, NULL, ASL_LEVEL_ERR,
        ^~~~~~~
2 warnings generated.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
Jeremy Huddleston Sequoia 2014-01-01 10:55:10 -08:00
parent a03f096a85
commit b2f6b3497c

View File

@ -353,6 +353,10 @@ main(int argc, char **argv, char **envp)
newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t)); newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t));
if (!newargv || !newenvp) { if (!newargv || !newenvp) {
/* Silence the clang static analyzer */
free(newargv);
free(newenvp);
asl_log(aslc, NULL, ASL_LEVEL_ERR, asl_log(aslc, NULL, ASL_LEVEL_ERR,
"Xquartz: Memory allocation failure"); "Xquartz: Memory allocation failure");
return EXIT_FAILURE; return EXIT_FAILURE;