blockd: fix resource leak discovered by coverity scan
[project/fstools.git] / blockd.c
index 3bfdea10313fc59a49cae407e8fbe936078aa55f..365755a537e2a3a9084c346bba356aa243dde183 100644 (file)
--- 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;