Date: Sat, 27 Feb 2021 23:15:35 GMT From: Ryan Moeller <freqlabs@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 1d9ba697f99a - main - libifconfig: Set error in ifconfig_get_groups Message-ID: <202102272315.11RNFZSm066958@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=1d9ba697f99a88b321a7d8b96fa142ea774cd3be commit 1d9ba697f99a88b321a7d8b96fa142ea774cd3be Author: Ryan Moeller <freqlabs@FreeBSD.org> AuthorDate: 2021-02-27 08:07:21 +0000 Commit: Ryan Moeller <freqlabs@FreeBSD.org> CommitDate: 2021-02-27 23:12:23 +0000 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 --- lib/libifconfig/libifconfig.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libifconfig/libifconfig.c b/lib/libifconfig/libifconfig.c index e67c4e4de04e..1733239132a0 100644 --- a/lib/libifconfig/libifconfig.c +++ b/lib/libifconfig/libifconfig.c @@ -511,7 +511,9 @@ ifconfig_get_groups(ifconfig_handle_t *h, const char *name, len = ifgr->ifgr_len; ifgr->ifgr_groups = (struct ifg_req *)malloc(len); if (ifgr->ifgr_groups == NULL) { - return (1); + h->error.errtype = OTHER; + h->error.errcode = ENOMEM; + return (-1); } bzero(ifgr->ifgr_groups, len); if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFGROUP, ifgr) == -1) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102272315.11RNFZSm066958>