From b3aa6d712e1345a57696e4d260ce49ccac253ba7 Mon Sep 17 00:00:00 2001
From: antirez <antirez@gmail.com>
Date: Tue, 27 Jul 2010 09:36:42 +0200
Subject: [PATCH 1/1] use the function deprecated attribute if compiling with
 GCC to get warnings for malloc/free usages. We always want to use our
 zmalloc/zfree versions for memory usage tracking

---
 src/redis.c | 2 +-
 src/redis.h | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/redis.c b/src/redis.c
index 9978eab5..f6040dfe 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -826,7 +826,7 @@ int qsortRedisCommands(const void *r1, const void *r2) {
 
 void sortCommandTable() {
     /* Copy and sort the read-only version of the command table */
-    commandTable = (struct redisCommand*)malloc(sizeof(readonlyCommandTable));
+    commandTable = (struct redisCommand*)zmalloc(sizeof(readonlyCommandTable));
     memcpy(commandTable,readonlyCommandTable,sizeof(readonlyCommandTable));
     qsort(commandTable,
         sizeof(readonlyCommandTable)/sizeof(struct redisCommand),
diff --git a/src/redis.h b/src/redis.h
index d5fabc2d..7aca2abc 100644
--- a/src/redis.h
+++ b/src/redis.h
@@ -885,4 +885,12 @@ void publishCommand(redisClient *c);
 void watchCommand(redisClient *c);
 void unwatchCommand(redisClient *c);
 
+#if defined(__GNUC__)
+void *malloc(size_t size) __attribute__ ((deprecated));
+void *calloc(size_t count, size_t size) __attribute__ ((deprecated));
+void free(void *ptr) __attribute__ ((deprecated));
+void *malloc(size_t size) __attribute__ ((deprecated));
+void *realloc(void *ptr, size_t size) __attribute__ ((deprecated));
+#endif
+
 #endif
-- 
2.47.2