Home  |  Linux  | Mysql  | PHP  | XML
From:Takeshi Abe Date:Thu Jul 31 05:35:30 2008
Subject:cvs: gd /libgd/src gdft.c
tabe		Thu Jul 31 11:35:30 2008 UTC

  Modified files:              
    /gd/libgd/src	gdft.c 
  Log:
  * avoid memory leak in case of gdRealloc's failure
  * strdup() should be accompanied by free()
  
  
http://cvs.php.net/viewvc.cgi/gd/libgd/src/gdft.c?r1=1.36&r2=1.37&diff_format=u
Index: gd/libgd/src/gdft.c
diff -u gd/libgd/src/gdft.c:1.36 gd/libgd/src/gdft.c:1.37
--- gd/libgd/src/gdft.c:1.36	Wed Nov 21 09:09:19 2007
+++ gd/libgd/src/gdft.c	Thu Jul 31 11:35:30 2008
@@ -1589,6 +1589,11 @@
       /* 2.0.22: Thorben Kundinger: +8 is needed, not +6. */
       fullname = gdRealloc (fullname,
                           strlen (fontsearchpath) + strlen (name) + 8);
+      if (!fullname) {
+          free (path);
+          free (fontlist);
+          return "could not alloc full path of font";
+      }
       /* if name is an absolute or relative pathname then test directly */
 #ifdef NETWARE
       /* netware uses the format "volume:/path" or the standard "/path" */
@@ -1604,7 +1609,7 @@
 	    {
 	      font_found++;
               /* 2.0.16: memory leak fixed, Gustavo Scotti */
-              gdFree (path);
+              free (path);
 	      break;
 	    }
 	}
@@ -1649,11 +1654,11 @@
 	      break;
 	    }
 	}
-      gdFree (path);
+      free (path);
       if (font_found)
 	break;
     }
-  gdFree (fontlist);
+  free (fontlist);
   if (!font_found)
     {
       gdFree (fullname);


Navigate in group php.gd.cvs at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants