summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_debug.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-04-06 13:28:23 +0000
committerAndrey Hristov <andrey@php.net>2010-04-06 13:28:23 +0000
commitb8484a2e89feffd25a6ecbfdc54a3ca6dd979860 (patch)
tree7197a6cb24ae95f699b5ff8d548c091a08a0ab48 /ext/mysqlnd/mysqlnd_debug.c
parent5f6a39d531c066e7e30091807dc7ba81abef420f (diff)
downloadphp-git-b8484a2e89feffd25a6ecbfdc54a3ca6dd979860.tar.gz
Recommit with an Windows build fix:
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)
Diffstat (limited to 'ext/mysqlnd/mysqlnd_debug.c')
-rw-r--r--ext/mysqlnd/mysqlnd_debug.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c
index 39c73fcbed..d80ddc246c 100644
--- a/ext/mysqlnd/mysqlnd_debug.c
+++ b/ext/mysqlnd/mysqlnd_debug.c
@@ -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)