summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWonki Kim <wonki_.kim@samsung.com>2020-12-24 11:48:53 +0900
committerHermet Park <chuneon.park@samsung.com>2020-12-24 11:48:53 +0900
commitb1c9b8cec0ea03cc4f95d5a6096b2a3fbe5019e6 (patch)
treee1b1cd0a0586165fc8b7e3bdc6442ab1f8085b1d
parent9a3127829950a886a2a81420cd281252d486dcf1 (diff)
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
-rw-r--r--src/lib/eeze/eeze_udev_syspath.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/eeze/eeze_udev_syspath.c b/src/lib/eeze/eeze_udev_syspath.c
index 4aca7fa74b..87b2c0fa78 100644
--- a/src/lib/eeze/eeze_udev_syspath.c
+++ b/src/lib/eeze/eeze_udev_syspath.c
@@ -78,7 +78,10 @@ eeze_udev_syspath_get_devpath(const char *syspath)
78 return NULL; 78 return NULL;
79 79
80 if (!(name = udev_device_get_devnode(device))) 80 if (!(name = udev_device_get_devnode(device)))
81 return NULL; 81 {
82 udev_device_unref(device);
83 return NULL;
84 }
82 85
83 name = eina_stringshare_add(name); 86 name = eina_stringshare_add(name);
84 udev_device_unref(device); 87 udev_device_unref(device);
@@ -98,7 +101,10 @@ eeze_udev_syspath_get_devname(const char *syspath)
98 return NULL; 101 return NULL;
99 102
100 if (!(name = udev_device_get_sysname(device))) 103 if (!(name = udev_device_get_sysname(device)))
101 return NULL; 104 {
105 udev_device_unref(device);
106 return NULL;
107 }
102 108
103 name = eina_stringshare_add(name); 109 name = eina_stringshare_add(name);
104 udev_device_unref(device); 110 udev_device_unref(device);