raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=257dced03842b9ac8bd4c18f59c29ca28717c9e0

commit 257dced03842b9ac8bd4c18f59c29ca28717c9e0
Author: Wonki Kim <wonki_....@samsung.com>
Date:   Mon Jan 25 08:50:28 2021 +0000

    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
---
 src/lib/eeze/eeze_udev_walk.c | 9 +++++----
 1 file 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,
    if (!(device = _new_device(syspath)))
      return NULL;
 
-   for (parent = device; parent;
-        child = parent, parent = udev_device_get_parent(child))
+   for (parent = device; parent;)
      {
         if ((test = udev_device_get_sysattr_value(parent, sysattr)))
           {
              test = eina_stringshare_add(test);
-             udev_device_unref(device);
+             udev_device_unref(parent);
              return test;
           }
+        child = parent;
+        parent = udev_device_get_parent(child);
+        udev_device_unref(child);
      }
 
-   udev_device_unref(device);
    return NULL;
 }

-- 


Reply via email to