naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

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

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