]> granicus.if.org Git - php/commitdiff
Recommit with an Windows build fix:
authorAndrey Hristov <andrey@php.net>
Tue, 6 Apr 2010 13:28:23 +0000 (13:28 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 6 Apr 2010 13:28:23 +0000 (13:28 +0000)
Fix inconsistencies
- memory allocated with spprintf, or likes, outside of mysqlnd's
allocator functions should not be freed by the mysqlnd's allocator
(a wrapper around emalloc/malloc).
- memory allocated by the mysqlnd's allocator should only be freed
  by it.
- add a mode to track memory usage (malloc/free)

ext/mysqlnd/mysqlnd_debug.c

index 39c73fcbed172956b06713a73f0aad05f6c6177c..d80ddc246cc341ffece51573ed38d18fbe3b7985 100644 (file)
@@ -658,8 +658,8 @@ PHPAPI void _mysqlnd_debug(const char * mode TSRMLS_DC)
 #endif
        
 #define REAL_SIZE(s) (collect_memory_statistics? (s) + sizeof(size_t) : (s))
-#define REAL_PTR(p) (collect_memory_statistics && (p)? ((p) - sizeof(size_t)) : (p))
-#define FAKE_PTR(p) (collect_memory_statistics && (p)? ((p) + sizeof(size_t)) : (p))
+#define REAL_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) - sizeof(size_t)) : (p))
+#define FAKE_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) + sizeof(size_t)) : (p))
 
 /* {{{ _mysqlnd_emalloc */
 void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D)