Merge pull request #486 from mmcco/null-check

Remove needless allocation error conditions
This commit is contained in:
Hisham Muhammad 2016-04-29 23:01:32 -03:00
commit 2ea4bee66d
2 changed files with 3 additions and 8 deletions

View File

@ -280,13 +280,11 @@ char* Platform_getProcessEnv(pid_t pid) {
size_t size = endp - p; size_t size = endp - p;
env = xMalloc(size+2); env = xMalloc(size+2);
if (env) {
memcpy(env, p, size); memcpy(env, p, size);
env[size] = 0; env[size] = 0;
env[size+1] = 0; env[size+1] = 0;
} }
} }
}
free(buf); free(buf);
} }
} }

View File

@ -265,9 +265,6 @@ void Platform_setSwapValues(Meter* this) {
} }
swdev = xCalloc(nswap, sizeof(*swdev)); swdev = xCalloc(nswap, sizeof(*swdev));
if (swdev == NULL) {
return;
}
rnswap = swapctl(SWAP_STATS, swdev, nswap); rnswap = swapctl(SWAP_STATS, swdev, nswap);
if (rnswap == -1) { if (rnswap == -1) {