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
This commit is contained in:
Wonki Kim 2020-12-24 11:43:28 +09:00 committed by Hermet Park
parent 00f5eed1d2
commit 37cecd5413
1 changed files with 5 additions and 1 deletions

View File

@ -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;