diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-05-26 20:54:07 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-05-26 20:54:07 +0000 |
commit | cc0ac600dfde00a69a997d1a1c227203d2cbe7f7 (patch) | |
tree | 520635d213e6256580dc8539b181133fcdfe84dd /sbin/pfctl | |
parent | d0e13ed783e880db3d09196c987aa639983a1450 (diff) |
Replace the following logic:
if (nothing to allocate)
ptr = malloc(1)
else {
if ((ptr = malloc(size to allocate))
memcpy(ptr, data to copy, size to allocate)
}
if (ptr == NULL)
OMG ERROR
with a saner logic where the NULL pointer check if moved to the actual
malloc branch, so that we do not need to malloc a single byte, just to avoid
having a NULL pointer.
Whoever thought allocating a single byte was a smart idea was obviously
not taking his meds.
ok beck@ guenther@
Diffstat (limited to 'sbin/pfctl')
0 files changed, 0 insertions, 0 deletions