cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=4492153c6ad360a97ab990f340ebf5be55218789

commit 4492153c6ad360a97ab990f340ebf5be55218789
Author: Vivek Ellur <vivek.el...@samsung.com>
Date:   Thu Oct 22 12:38:28 2015 -0700

    elm_index: Fix memory leak issue in realloc failure
    
    Summary:
    @Fix
    
    Signed-off-by: Vivek Ellur <vivek.el...@samsung.com>
    
    Reviewers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D3214
---
 src/lib/elm_index.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c
index 83194a7..7f3cb39 100644
--- a/src/lib/elm_index.c
+++ b/src/lib/elm_index.c
@@ -770,14 +770,17 @@ _sel_eval(Evas_Object *obj,
                     {
                        if (label && last)
                          {
-                            label = realloc(label, strlen(label) +
+                            char *temp;
+
+                            temp = realloc(label, strlen(label) +
                                             strlen(last) + 1);
-                            if (!label)
+                            if (!temp)
                               {
+                                 free(label);
                                  free(last);
                                  return;
                               }
-                            strcat(label, last);
+                            label = strcat(temp, last);
                          }
                     }
                   free(last);

-- 


Reply via email to