From 37cecd54139ec8b7c81c71f5fb1c6c07a60815cb Mon Sep 17 00:00:00 2001 From: Wonki Kim Date: Thu, 24 Dec 2020 11:43:28 +0900 Subject: [PATCH] eeze_net: fix a potentional memory leak case Summary: if `net` equals zero and `device` has allocated properly at the same time, memory leaks. this patch fixes it. Reviewers: Hermet, bu5hm4n, zmike Reviewed By: Hermet Subscribers: vtorri, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12221 --- src/lib/eeze/eeze_net.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/eeze/eeze_net.c b/src/lib/eeze/eeze_net.c index 47887d74b6..bdd7181993 100644 --- a/src/lib/eeze/eeze_net.c +++ b/src/lib/eeze/eeze_net.c @@ -78,7 +78,11 @@ eeze_net_new(const char *name) } if (!device) return NULL; net = calloc(1, sizeof(Eeze_Net)); - if (!net) return NULL; + if (!net) + { + udev_device_unref(device); + return NULL; + } EINA_REFCOUNT_INIT(net); net->device = device; net->syspath = syspath;