eeze_syspaty: fix a potention memory leak

Summary:
if udev device get sysname fails, memory leaks.
this patch fixes the problem.

Change-Id: I2d02a6e6eb98e9262255ab3c02cf99f347b8c5f9

Reviewers: bu5hm4n, Hermet, zmike

Reviewed By: Hermet

Subscribers: vtorri, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12222
This commit is contained in:
Wonki Kim 2020-12-24 11:48:53 +09:00 committed by Hermet Park
parent 9a31278299
commit b1c9b8cec0
1 changed files with 8 additions and 2 deletions

View File

@ -78,7 +78,10 @@ eeze_udev_syspath_get_devpath(const char *syspath)
return NULL;
if (!(name = udev_device_get_devnode(device)))
return NULL;
{
udev_device_unref(device);
return NULL;
}
name = eina_stringshare_add(name);
udev_device_unref(device);
@ -98,7 +101,10 @@ eeze_udev_syspath_get_devname(const char *syspath)
return NULL;
if (!(name = udev_device_get_sysname(device)))
return NULL;
{
udev_device_unref(device);
return NULL;
}
name = eina_stringshare_add(name);
udev_device_unref(device);