#endif
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_MALLOC_COUNT, 1, STAT_MEM_MALLOC_AMOUNT, size);
}
#endif
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_CALLOC_COUNT, 1, STAT_MEM_CALLOC_AMOUNT, size);
}
DBG_INF_FMT("new_ptr=%p", (char*)ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
*(size_t *) ret = new_size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_REALLOC_COUNT, 1, STAT_MEM_REALLOC_AMOUNT, new_size);
}
ret = pemalloc(tmp_str.len + sizeof(size_t), persistent);
memcpy(FAKE_PTR(ret), tmp_str.c, tmp_str.len);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
*(size_t *) ret = tmp_str.len;
MYSQLND_INC_GLOBAL_STATISTIC(persistent? STAT_MEM_STRDUP_COUNT : STAT_MEM_ESTRDUP_COUNT);
}