summaryrefslogtreecommitdiffstats
path: root/openbsd
diff options
context:
space:
mode:
authorMichael McConville <mmcco@mykolab.com>2016-01-02 12:20:40 -0500
committerMichael McConville <mmcco@mykolab.com>2016-01-02 12:20:40 -0500
commitc1b32892190ee0b605cac5087fb000f6cefc4b1e (patch)
tree603d90308b6496abe44300d819e30b3ce654c18e /openbsd
parentae5c01f4859e3296292bd34b2efc5a7720368d98 (diff)
Check for allocation failure
Pointed out by Michael Reed.
Diffstat (limited to 'openbsd')
-rw-r--r--openbsd/OpenBSDProcessList.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c
index aa765a15..d6420853 100644
--- a/openbsd/OpenBSDProcessList.c
+++ b/openbsd/OpenBSDProcessList.c
@@ -139,7 +139,8 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
for (i = 0; arg[i] != NULL; i++) {
len += strlen(arg[i]) + 1;
}
- buf = s = malloc(len);
+ if ((buf = s = malloc(len)) == NULL)
+ err(1, NULL);
for (i = 0; arg[i] != NULL; i++) {
n = strlcpy(buf, arg[i], (s + len) - buf);
buf += n;

© 2014-2024 Faster IT GmbH | imprint | privacy policy