forked from enlightenment/efl
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:
parent
00f5eed1d2
commit
37cecd5413
|
@ -78,7 +78,11 @@ eeze_net_new(const char *name)
|
||||||
}
|
}
|
||||||
if (!device) return NULL;
|
if (!device) return NULL;
|
||||||
net = calloc(1, sizeof(Eeze_Net));
|
net = calloc(1, sizeof(Eeze_Net));
|
||||||
if (!net) return NULL;
|
if (!net)
|
||||||
|
{
|
||||||
|
udev_device_unref(device);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
EINA_REFCOUNT_INIT(net);
|
EINA_REFCOUNT_INIT(net);
|
||||||
net->device = device;
|
net->device = device;
|
||||||
net->syspath = syspath;
|
net->syspath = syspath;
|
||||||
|
|
Loading…
Reference in New Issue