summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWonki Kim <wonki_.kim@samsung.com>2021-01-25 08:50:28 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-01-25 08:55:24 +0000
commit257dced03842b9ac8bd4c18f59c29ca28717c9e0 (patch)
tree7de1853429b0bdcd56e8736b63191f7729b75d64 /src
parentd37958c1b0b005b8f04a6ee951d83f6af6e79689 (diff)
eeze walk: fix a memory leaking
Summary: there is a memory leak in a logic for walking along child-parent relation, in case of device_get_sysattr_value failure. this patch fixes the leak. Change-Id: I95e9484b1549d1c794ec529c995af33da9b8a0ee Reviewers: bu5hm4n, zmike Subscribers: raster, SPAM-TeresaButler, vtorri, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12224
Diffstat (limited to 'src')
-rw-r--r--src/lib/eeze/eeze_udev_walk.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/eeze/eeze_udev_walk.c b/src/lib/eeze/eeze_udev_walk.c
index 78e2aabda4..4cd661b184 100644
--- a/src/lib/eeze/eeze_udev_walk.c
+++ b/src/lib/eeze/eeze_udev_walk.c
@@ -49,17 +49,18 @@ eeze_udev_walk_get_sysattr(const char *syspath,
49 if (!(device = _new_device(syspath))) 49 if (!(device = _new_device(syspath)))
50 return NULL; 50 return NULL;
51 51
52 for (parent = device; parent; 52 for (parent = device; parent;)
53 child = parent, parent = udev_device_get_parent(child))
54 { 53 {
55 if ((test = udev_device_get_sysattr_value(parent, sysattr))) 54 if ((test = udev_device_get_sysattr_value(parent, sysattr)))
56 { 55 {
57 test = eina_stringshare_add(test); 56 test = eina_stringshare_add(test);
58 udev_device_unref(device); 57 udev_device_unref(parent);
59 return test; 58 return test;
60 } 59 }
60 child = parent;
61 parent = udev_device_get_parent(child);
62 udev_device_unref(child);
61 } 63 }
62 64
63 udev_device_unref(device);
64 return NULL; 65 return NULL;
65} 66}