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
@ -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…
x
Reference in New Issue
Block a user