From: Phil Sutter Date: Thu, 6 Aug 2015 12:24:33 +0000 (+0200) Subject: misc/ss: simplify buffer realloc, fix checking realloc failure X-Git-Tag: v4.2.0~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=532ca40a52d4103816f2e50690a02e9dd6c1abe5;p=thirdparty%2Fiproute2.git misc/ss: simplify buffer realloc, fix checking realloc failure Signed-off-by: Phil Sutter --- diff --git a/misc/ss.c b/misc/ss.c index d271b9506..e61fb2ed0 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -550,7 +550,7 @@ static int find_entry(unsigned ino, char **buf, int type) struct user_ent *p; int cnt = 0; char *ptr; - char **new_buf = buf; + char *new_buf; int len, new_buf_len; int buf_used = 0; int buf_len = 0; @@ -592,12 +592,12 @@ static int find_entry(unsigned ino, char **buf, int type) if (len < 0 || len >= buf_len - buf_used) { new_buf_len = buf_len + ENTRY_BUF_SIZE; - *new_buf = realloc(*buf, new_buf_len); + new_buf = realloc(*buf, new_buf_len); if (!new_buf) { fprintf(stderr, "ss: failed to malloc buffer\n"); abort(); } - *buf = *new_buf; + *buf = new_buf; buf_len = new_buf_len; continue; } else {