diff options
author | Hisham <hisham@gobolinux.org> | 2016-02-02 15:53:02 +0100 |
---|---|---|
committer | Hisham <hisham@gobolinux.org> | 2016-02-02 15:53:02 +0100 |
commit | b54d2dde407921caa7561dde6b45831ba93d0840 (patch) | |
tree | cd81eea35dd65e46d22f2801ea403e1efc06eb59 /darwin/Platform.c | |
parent | a1f7f2869ec2bd860d5b4e4b39736ca877afdf6f (diff) |
Check for failure in allocations.
Diffstat (limited to 'darwin/Platform.c')
-rw-r--r-- | darwin/Platform.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/darwin/Platform.c b/darwin/Platform.c index 22a18774..303b6c15 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -251,7 +251,7 @@ char* Platform_getProcessEnv(pid_t pid) { mib[0] = CTL_KERN; mib[1] = KERN_ARGMAX; if (sysctl(mib, 2, &argmax, &bufsz, 0, 0) == 0) { - char* buf = malloc(argmax); + char* buf = xMalloc(argmax); if (buf) { mib[0] = CTL_KERN; mib[1] = KERN_PROCARGS2; @@ -279,7 +279,7 @@ char* Platform_getProcessEnv(pid_t pid) { ++p; size_t size = endp - p; - env = malloc(size+2); + env = xMalloc(size+2); if (env) { memcpy(env, p, size); env[size] = 0; |