From: Daniel Golle Date: Thu, 12 Aug 2021 15:34:39 +0000 (+0100) Subject: blockd: fix resource leak discovered by coverity scan X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=629726dfea57d03219c00b9e8972ef3d1d550446;p=project%2Ffstools.git blockd: fix resource leak discovered by coverity scan Fixes Coverity CID 1463265 Signed-off-by: Daniel Golle --- diff --git a/blockd.c b/blockd.c index 3bfdea1..365755a 100644 --- a/blockd.c +++ b/blockd.c @@ -152,6 +152,9 @@ static int hotplug_call_mount(struct ubus_context *ctx, const char *action, pid = fork(); switch (pid) { case -1: + if (c) + free(c); + err = -errno; ULOG_ERR("fork() failed\n"); return err;