diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c index aa765a1576b9ecf45af9dd9a9755733b5ca2f0ef..d6420853654a27ce96bc8fb721fd6c840e7f3bb0 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;