From: Alexander Couzens Date: Sun, 11 Jun 2017 09:52:47 +0000 (+0200) Subject: hotplug: fix a memory leak in handle_button_complete() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6b0da203c0ad0e91e281bdcf271a37ad93ca5b13;p=project%2Fprocd.git hotplug: fix a memory leak in handle_button_complete() Found-by: Coverity Scan #1412460 Signed-off-by: Alexander Couzens --- diff --git a/plug/hotplug.c b/plug/hotplug.c index c8bea1b..ce29ced 100644 --- a/plug/hotplug.c +++ b/plug/hotplug.c @@ -431,8 +431,11 @@ static void handle_button_complete(struct blob_attr *msg, struct blob_attr *data if (!timeout) return; + if (!name) + return; + b = malloc(sizeof(*b)); - if (!b || !name) + if (!b) return; memset(b, 0, sizeof(*b));