linma / rpms / iproute

Forked from rpms/iproute 4 years ago
Clone

Blame SOURCES/0082-ss-Fix-potential-memleak-in-unix_stats_print.patch

99be8f
From 125c0e845acd690c9dce5702413294304a328fd1 Mon Sep 17 00:00:00 2001
99be8f
From: Andrea Claudi <aclaudi@redhat.com>
99be8f
Date: Mon, 29 Apr 2019 20:07:22 +0200
99be8f
Subject: [PATCH] ss: Fix potential memleak in unix_stats_print()
99be8f
99be8f
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
99be8f
Upstream Status: iproute2.git commit 46131577cf1ba
99be8f
99be8f
commit 46131577cf1ba37198c82e1ce89c9bbca2153ef4
99be8f
Author: Phil Sutter <phil@nwl.cc>
99be8f
Date:   Thu Aug 17 19:09:30 2017 +0200
99be8f
99be8f
    ss: Fix potential memleak in unix_stats_print()
99be8f
99be8f
    Fixes: 2d0e538f3e1cd ("ss: Drop list traversal from unix_stats_print()")
99be8f
    Signed-off-by: Phil Sutter <phil@nwl.cc>
99be8f
---
99be8f
 misc/ss.c | 4 +++-
99be8f
 1 file changed, 3 insertions(+), 1 deletion(-)
99be8f
99be8f
diff --git a/misc/ss.c b/misc/ss.c
99be8f
index eb46e0c4b95fb..c97f05a4c7033 100644
99be8f
--- a/misc/ss.c
99be8f
+++ b/misc/ss.c
99be8f
@@ -3258,8 +3258,10 @@ static int unix_show(struct filter *f)
99be8f
 
99be8f
 		if (name[0]) {
99be8f
 			u->name = strdup(name);
99be8f
-			if (!u->name)
99be8f
+			if (!u->name) {
99be8f
+				free(u);
99be8f
 				break;
99be8f
+			}
99be8f
 		}
99be8f
 
99be8f
 		if (u->rport) {
99be8f
-- 
d30c09
2.21.0
99be8f