]> git.ipfire.org Git - thirdparty/iproute2.git/commit
misc: fix memory leak in ifstat.c
authorAnton Moryakov <ant.v.moryakov@gmail.com>
Sat, 19 Jul 2025 10:42:12 +0000 (13:42 +0300)
committerDavid Ahern <dsahern@kernel.org>
Tue, 29 Jul 2025 23:12:34 +0000 (23:12 +0000)
commit0b09a1b053a2f4dbba6128b3fb703e008819c791
tree360376e9e87404503876abb415bf722aa29f1d49
parent27d11a81197c60a409dda84de01cf0aa841530f9
misc: fix memory leak in ifstat.c

A memory leak was detected by the static analyzer SVACE in the function
get_nlmsg_extended(). The issue occurred when parsing extended interface
statistics failed due to a missing nested attribute. In this case,
memory allocated for 'n->name' via strdup() was not freed before returning,
resulting in a leak.

The fix adds an explicit 'free(n->name)' call before freeing the containing
structure in the error path.

Reported-by: SVACE static analyzer
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
misc/ifstat.c