From: Phil Sutter Date: Thu, 17 Aug 2017 17:09:28 +0000 (+0200) Subject: ifstat: Fix memleak in error case X-Git-Tag: v4.13.0~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35f6adefb8f9d56437f5455ac8c0c3cc329e3317;p=thirdparty%2Fiproute2.git ifstat: Fix memleak in error case Signed-off-by: Phil Sutter --- diff --git a/misc/ifstat.c b/misc/ifstat.c index a853ee6d7..8fa354265 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -143,8 +143,10 @@ static int get_nlmsg_extended(const struct sockaddr_nl *who, struct rtattr *attr; attr = parse_rtattr_one_nested(sub_type, tb[filter_type]); - if (attr == NULL) + if (attr == NULL) { + free(n); return 0; + } memcpy(&n->val, RTA_DATA(attr), sizeof(n->val)); } memset(&n->rate, 0, sizeof(n->rate));