mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Do not leak the OFW memory when the result does not satisfy our alignment
requirement. While here, fix style(9) issues.
This commit is contained in:
parent
33c380b096
commit
9855acef2a
1 changed files with 7 additions and 2 deletions
|
|
@ -459,11 +459,16 @@ OF_getencprop_alloc(phandle_t package, const char *name, int elsz, void **buf)
|
|||
int i;
|
||||
|
||||
retval = OF_getprop_alloc(package, name, elsz, buf);
|
||||
if (retval == -1 || retval*elsz % 4 != 0)
|
||||
if (retval == -1)
|
||||
return (-1);
|
||||
if (retval * elsz % 4 != 0) {
|
||||
free(*buf, M_OFWPROP);
|
||||
*buf = NULL;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
cell = *buf;
|
||||
for (i = 0; i < retval*elsz/4; i++)
|
||||
for (i = 0; i < retval * elsz / 4; i++)
|
||||
cell[i] = be32toh(cell[i]);
|
||||
|
||||
return (retval);
|
||||
|
|
|
|||
Loading…
Reference in a new issue