Message ID | e09c1c3ce34d932e10299bd4a41380d43a5a1a8d.1509307616.git.sbrivio@redhat.com |
---|---|
State | Changes Requested, archived |
Delegated to: | stephen hemminger |
Headers | show |
Series | ss: netlink_show_one() clean-up, minor output fix | expand |
diff --git a/misc/ss.c b/misc/ss.c index fa026eb0934b..fb80d84122fc 100644 --- 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) {
There's no need to check 'pid_context' before calling free(). Signed-off-by: Stefano Brivio <sbrivio@redhat.com> --- misc/ss.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)