]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
misc/ss: fix memory leak in user_ent_hash_build()
authorPhil Sutter <phil@nwl.cc>
Thu, 6 Aug 2015 12:24:36 +0000 (14:24 +0200)
committerStephen Hemminger <shemming@brocade.com>
Wed, 12 Aug 2015 16:23:47 +0000 (09:23 -0700)
Signed-off-by: Phil Sutter <phil@nwl.cc>
misc/ss.c

index 90c2eda4ea2c07c82f7949b675f4f8b0aa8338c6..2f34962284785ea1360e55281ac550298ad19396 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -483,8 +483,10 @@ static void user_ent_hash_build(void)
 
                sprintf(name + nameoff, "%d/fd/", pid);
                pos = strlen(name);
-               if ((dir1 = opendir(name)) == NULL)
+               if ((dir1 = opendir(name)) == NULL) {
+                       free(pid_context);
                        continue;
+               }
 
                process[0] = '\0';
                p = process;