libifconfig: Set error in ifconfig_get_groups
This should return -1 with OTHER/ENOMEM set in the handle when malloc fails, like everywhere else in libifconfig. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28964
This commit is contained in:
parent
1d8510c1a6
commit
1d9ba697f9
@ -511,7 +511,9 @@ ifconfig_get_groups(ifconfig_handle_t *h, const char *name,
|
|||||||
len = ifgr->ifgr_len;
|
len = ifgr->ifgr_len;
|
||||||
ifgr->ifgr_groups = (struct ifg_req *)malloc(len);
|
ifgr->ifgr_groups = (struct ifg_req *)malloc(len);
|
||||||
if (ifgr->ifgr_groups == NULL) {
|
if (ifgr->ifgr_groups == NULL) {
|
||||||
return (1);
|
h->error.errtype = OTHER;
|
||||||
|
h->error.errcode = ENOMEM;
|
||||||
|
return (-1);
|
||||||
}
|
}
|
||||||
bzero(ifgr->ifgr_groups, len);
|
bzero(ifgr->ifgr_groups, len);
|
||||||
if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFGROUP, ifgr) == -1) {
|
if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFGROUP, ifgr) == -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user