]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ss: Streamline process context printing in netlink_show_one()
authorStefano Brivio <sbrivio@redhat.com>
Tue, 31 Oct 2017 17:47:55 +0000 (18:47 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 1 Nov 2017 21:10:52 +0000 (22:10 +0100)
There's no need to check 'pid_context' before calling free().

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
misc/ss.c

index fa026eb0934b414ec7bcc844d6318702bba56d66..fb80d84122fc06ed31e6e87c523a7282eafac42e 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -3593,12 +3593,8 @@ static int netlink_show_one(struct filter *f,
                else if (pid > 0)
                        getpidcon(pid, &pid_context);
 
-               if (pid_context != NULL) {
-                       printf(" proc_ctx=%s", pid_context);
-                       free(pid_context);
-               } else {
-                       printf(" proc_ctx=unavailable");
-               }
+               printf(" proc_ctx=%s", pid_context ? : "unavailable");
+               free(pid_context);
        }
 
        if (show_details) {