summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2014-01-01 10:55:10 -0800
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2014-01-22 15:16:30 -0800
commit64b0669d1c062e7e11fb0e3b8ea7fe56113fc86f (patch)
tree77887d7d4d281089d7dcae483a19ea0920e73667
parent472e8e5d1c26573cef4bd42451230ef47791ed6f (diff)
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> (cherry picked from commit b2f6b3497c33a4897afae80a2cf69c596b9f81e8)
-rw-r--r--hw/xquartz/mach-startup/stub.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index b5a3168ca..756e4ef2d 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -353,6 +353,10 @@ main(int argc, char **argv, char **envp)
newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t));
if (!newargv || !newenvp) {
+ /* Silence the clang static analyzer */
+ free(newargv);
+ free(newenvp);
+
asl_log(aslc, NULL, ASL_LEVEL_ERR,
"Xquartz: Memory allocation failure");
return EXIT_FAILURE;