Vincent Torri wrote:


On Tue, 13 Mar 2007, Stéphane Bauland wrote:

Hi!

1) Why ecore_str_vector_free was removed ?

now, you only need to free the returned pointer. There's no need for a function to do that :)

I let the others comment the 2nd question :)

Vincent
Ok ok i solve memory leak... I don't know if it's a correct way to remove it but apparently it's ok.


? ecorestr.patch
cvs diff: Diffing .
Index: ecore_str.c
===================================================================
RCS file: /var/cvs/e/e17/libs/ecore/src/lib/ecore/ecore_str.c,v
retrieving revision 1.7
diff -u -r1.7 ecore_str.c
--- ecore_str.c	13 Mar 2007 06:46:14 -0000	1.7
+++ ecore_str.c	13 Mar 2007 10:07:48 -0000
@@ -164,9 +164,10 @@
    dlen = strlen(delim);
    s = strdup(str);
    str_array = malloc(sizeof(char *) * (len + 1));
-   for (i = 0; (i < max_tokens) && (sep = strstr(s, delim)); i++) 
+   for (i = 0; (i < max_tokens) && (sep = strstr(s, delim)); i++)
       {
           str_array[i] = s;
+          if ( i == 0 ) FREE(s);
           s = sep + dlen;
           *sep = 0;
       }
@@ -174,7 +175,6 @@
    str_array[i++] = s;
    str_array = realloc(str_array, sizeof(char *) * (i + 1));
    str_array[i] = NULL;
- 
    return str_array;
 }
 
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to