Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_desktop Modified Files: ecore_desktop_menu.c Log Message: don't leak when input is invalid (<New> w/o an <Old> e.g.) add a fixme =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_menu.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -3 -r1.36 -r1.37 --- ecore_desktop_menu.c 13 Nov 2006 22:08:10 -0000 1.36 +++ ecore_desktop_menu.c 20 Dec 2006 19:50:37 -0000 1.37 @@ -266,6 +266,7 @@ /* Setup the merge stack. */ if (merge_stack->size <= level) { + /* XXX storing a pointer to a static string probably isn't a good idea. this is most likely the cause of the valgrind error mentioned below. (once this function has exited that memory will no longer be valid) */ while (merge_stack->size < level) ecore_desktop_tree_add(merge_stack, ""); ecore_desktop_tree_add(merge_stack, file); @@ -294,6 +295,9 @@ * which is the strcmp just above. But it doesn't complain about the first two if's, * or the printf, which I inserted to try and track this down. * No idea what it actually is complaining about, so I'll comment it for future study. + * + * This is probably caused by the fact that a static string was passed into the + * tree. See the comment above where this occurs. */ fprintf(stderr, "\n### Oops, infinite menu merging loop detected at %s\n", @@ -1029,11 +1033,12 @@ sprintf(temp, "<MOVE <%s> <%s>", old, new); ecore_desktop_tree_extend(menu, temp); - free(old); - old = NULL; - free(new); - new = NULL; } + + if (old) free(old); + old = NULL; + if (new) free(new); + new = NULL; } } ------------------------------------------------------------------------- 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-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs