summaryrefslogtreecommitdiff
path: root/hiredis.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-26 14:47:01 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-26 14:47:01 +0100
commitf14108361b23f20d38dbc13dc8cc11b6fef33f0c (patch)
tree97e0b76aa53317b39906b12bdede4f6da4b5b301 /hiredis.c
parent5cf292cdd05ad430b66bd3bc163312ef50a4ac32 (diff)
Reply objects don't need to be calloc'ed
Diffstat (limited to 'hiredis.c')
-rw-r--r--hiredis.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hiredis.c b/hiredis.c
index f50b046..6db1075 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -70,7 +70,7 @@ static redisReplyObjectFunctions defaultFunctions = {
/* Create a reply object */
static redisReply *createReplyObject(int type) {
- redisReply *r = calloc(sizeof(*r),1);
+ redisReply *r = malloc(sizeof(*r));
if (!r) redisOOM();
r->type = type;
@@ -90,9 +90,10 @@ void freeReplyObject(void *reply) {
if (r->element[j]) freeReplyObject(r->element[j]);
free(r->element);
break;
- default:
- if (r->str != NULL)
- free(r->str);
+ case REDIS_REPLY_ERROR:
+ case REDIS_REPLY_STATUS:
+ case REDIS_REPLY_STRING:
+ free(r->str);
break;
}
free(r);