From f367ec686bc7ff2d37a93f795a1b510a61dc33be Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Sun, 11 Jun 2017 11:52:47 +0200 Subject: [PATCH] hotplug: fix a memory leak in handle_button_complete() Found-by: Coverity Scan #1412460 Signed-off-by: Alexander Couzens --- plug/hotplug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)); -- 2.30.2