patch: fix memory leak in tags.c

Ivan Skytte Jørgensen isj-nedit-dev at i1.dk
Mon Oct 15 22:52:44 CEST 2007


(I don't bother make a real patch file for this one - it is too msall)
tags.c still has some problems if malloc() fails, but that should be handled 
in a complete patch.

diff -r -U3 nedit.isj6/source/tags.c nedit.isj7/source/tags.c
--- nedit.isj6/source/tags.c    2007-03-05 00:26:05.000000000 +0100
+++ nedit.isj7/source/tags.c    2007-10-15 22:47:47.000000000 +0200
@@ -1218,6 +1218,7 @@
                 sprintf(temp,"%2d. %s%s",i+1,pathname,filename);
             if (!(dupTagsList[i] = (char *) malloc(strlen(temp) + 1))) {
                 fprintf(stderr, "NEdit: findDef(): out of heap space!\n");
+                free(dupTagsList);
                 XBell(TheDisplay, 0);
                 return -1;
             }


More information about the Develop mailing list