summaryrefslogtreecommitdiff
path: root/hw/xquartz/mach-startup
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-12 23:12:48 -0800
commitb2f6b3497c33a4897afae80a2cf69c596b9f81e8 (patch)
tree2bee01b42679d263df5b4a5e2a14b5193080ea59 /hw/xquartz/mach-startup
parenta03f096a85537d9e881cedaa6cb71aca43a97086 (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>
Diffstat (limited to 'hw/xquartz/mach-startup')
-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;