getline() may allocate line1 even when it returns -1, and the caller must free the buffer on the error path. When batch input ends with a missing continuation line, getcmdline() returns without freeing line1. This can be reproduced with: printf 'link show \\\n' | ./ip/ip -batch - Free line1 before returning. Valgrind reports 120 bytes definitely lost before this change. Fixes: c2f3a0f94de9 ("Fix batch mode, allow continuation, comments, etc.") Signed-off-by: Mohammad abu saleh --- lib/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/utils.c b/lib/utils.c index 50602e59..6388d981 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -1372,6 +1372,7 @@ static ssize_t getcmdline(char **linep, size_t *lenp, FILE *in) cc1 = getline(&line1, &len1, in); if (cc1 < 0) { fprintf(stderr, "Missing continuation line\n"); + free(line1); return cc1; } -- 2.53.0