]> granicus.if.org Git - php/commitdiff
Changed memory allocation wrappers to macros, so that it is possible to see
authorIlia Alshanetsky <iliaa@php.net>
Mon, 18 Nov 2002 12:31:39 +0000 (12:31 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 18 Nov 2002 12:31:39 +0000 (12:31 +0000)
where the memory leak is happening.

ext/gd/libgd/gd_jpeg.c
ext/gd/libgd/gd_png.c
ext/gd/libgd/gdhelpers.c
ext/gd/libgd/gdhelpers.h

index b0bfb0a0652319e10854599bddcbeafcf5a7530d..7ea923b25a736579b8d586f8dfbcf603ae01858d 100644 (file)
@@ -29,6 +29,7 @@
 /* JCE: arrange HAVE_LIBJPEG so that it can be set in gd.h */
 #ifdef HAVE_LIBJPEG
 #include "gdhelpers.h"
+#undef HAVE_STDLIB_H
 
 /* 1.8.1: remove dependency on jinclude.h */
 #include "jpeglib.h"
index 1c91eaa16cf944e9864063d218a7de70ec92227b..adc9b46c57cece0cb7bacd7c8921b613d561ba06 100644 (file)
@@ -7,8 +7,9 @@
 /* JCE: Arrange HAVE_LIBPNG so that it can be set in gd.h */
 #ifdef HAVE_LIBPNG
 
-#include "gdhelpers.h"
+
 #include "png.h"               /* includes zlib.h and setjmp.h */
+#include "gdhelpers.h"
 
 #define TRUE 1
 #define FALSE 0
index 32620e855159dc9dc1bd64c058c8cf63f981e1ba..ae2428dfcde65b665a69e562e75e54ef400f725e 100644 (file)
@@ -2,8 +2,6 @@
 #include "config.h"
 #endif
 
-#include "php.h"
-
 #include "gd.h"
 #include "gdhelpers.h"
 #include <stdlib.h>
@@ -76,33 +74,3 @@ gd_strtok_r (char *s, char *sep, char **state)
   *state = s;
   return result;
 }
-
-void *
-gdCalloc (size_t nmemb, size_t size)
-{
-  return ecalloc (nmemb, size);
-}
-
-void *
-gdMalloc (size_t size)
-{
-  return emalloc (size);
-}
-
-void *
-gdRealloc (void *ptr, size_t size)
-{
-  return erealloc (ptr, size);
-}
-
-void
-gdFree (void *ptr)
-{
-  efree (ptr);
-}
-
-char *
-gdEstrdup (const char *ptr)
-{
-  return estrdup(ptr);
-}
index 5b27638783b8a88d8a341792bd99b5717974ead8..bb689cbefe20bca46c3bcb1a4b290197e18ebe32 100644 (file)
@@ -2,6 +2,7 @@
 #define GDHELPERS_H 1
 
 #include <sys/types.h>
+#include "php.h"
 
 /* TBB: strtok_r is not universal; provide an implementation of it. */
 
@@ -11,10 +12,11 @@ extern char *gd_strtok_r(char *s, char *sep, char **state);
        in gd.h, where callers can utilize it to correctly
        free memory allocated by these functions with the
        right version of free(). */
-void *gdCalloc(size_t nmemb, size_t size);
-void *gdMalloc(size_t size);
-void *gdRealloc(void *ptr, size_t size);
-char *gdEstrdup(const char *ptr);
+#define gdCalloc(nmemb, size)  ecalloc(nmemb, size)
+#define gdMalloc(size)         emalloc(size)
+#define gdRealloc(ptr, size)   erealloc(ptr, size)
+#define gdEstrdup(ptr)         estrdup(ptr)
+#define gdFree(ptr)            efree(ptr)
 
 #endif /* GDHELPERS_H */