diff options
author | Wonki Kim <wonki_.kim@samsung.com> | 2020-12-24 11:43:28 +0900 |
---|---|---|
committer | Hermet Park <chuneon.park@samsung.com> | 2020-12-24 11:43:28 +0900 |
commit | 37cecd54139ec8b7c81c71f5fb1c6c07a60815cb (patch) | |
tree | ab6e952f75a6a998ed5616703299596c8ae94fee | |
parent | 00f5eed1d2390d204c83a2cb78a37531f6bbe49c (diff) |
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
-rw-r--r-- | src/lib/eeze/eeze_net.c | 6 |
1 files changed, 5 insertions, 1 deletions
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) | |||
78 | } | 78 | } |
79 | if (!device) return NULL; | 79 | if (!device) return NULL; |
80 | net = calloc(1, sizeof(Eeze_Net)); | 80 | net = calloc(1, sizeof(Eeze_Net)); |
81 | if (!net) return NULL; | 81 | if (!net) |
82 | { | ||
83 | udev_device_unref(device); | ||
84 | return NULL; | ||
85 | } | ||
82 | EINA_REFCOUNT_INIT(net); | 86 | EINA_REFCOUNT_INIT(net); |
83 | net->device = device; | 87 | net->device = device; |
84 | net->syspath = syspath; | 88 | net->syspath = syspath; |