hotplug-dispatch: yet another rare memory leak disovered by Coverity
authorDaniel Golle <daniel@makrotopia.org>
Fri, 13 Aug 2021 18:04:08 +0000 (19:04 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Sat, 14 Aug 2021 17:57:44 +0000 (18:57 +0100)
Free newly allocated hotplug context in case of premature return.

Coverity CID: 1490077
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
hotplug-dispatch.c

index cfba7d19b745725bbf0e81eadd9639055e4b45c7..f1ece3833f235d59b321d6d9bd89ea3ef621fcd9 100644 (file)
@@ -298,7 +298,7 @@ static int hotplug_call(struct ubus_context *ctx, struct ubus_object *obj,
 
        /* glob'ing for hotplug scripts */
        if (asprintf(&globstr, "%s/%s/*", HOTPLUG_BASEDIR, subsys) == -1) {
-               env_free(envp);
+               hotplug_free(pc);
                return UBUS_STATUS_UNKNOWN_ERROR;
        }