From b11972e2920a0e7641c3a84fad56cd82c093ed0c Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 25 May 2018 17:14:49 +0200 Subject: tools: Fix memleaks as reported by cppcheck This fixes two memleaks which were reported by cppcheck. Signed-off-by: Sander Vrijders Signed-off-by: Dimitri Staessens --- src/tools/oping/oping_client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/tools/oping') diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c index d026a683..97e9c8d3 100644 --- a/src/tools/oping/oping_client.c +++ b/src/tools/oping/oping_client.c @@ -129,8 +129,10 @@ void * writer(void * o) if (buf == NULL) return (void *) -ENOMEM; - if (fdp == NULL) + if (fdp == NULL) { + free(buf); return (void *) -EINVAL; + } memset(buf, 0, client.size); -- cgit v1.2.3