diff --git a/src/mod/applications/mod_redis/credis.c b/src/mod/applications/mod_redis/credis.c index a76cbedf49..8f1b749e67 100644 --- a/src/mod/applications/mod_redis/credis.c +++ b/src/mod/applications/mod_redis/credis.c @@ -162,9 +162,13 @@ static int cr_morebulk(cr_multibulk *mb, int size) DEBUG("allocate %d x CR_MULTIBULK_SIZE, total %d (%lu bytes)", n, total, total * ((sizeof(char *)+sizeof(int)))); cptr = realloc(mb->bulks, total * sizeof(char *)); + + if (cptr == NULL) + return CREDIS_ERR_NOMEM; + iptr = realloc(mb->idxs, total * sizeof(int)); - if (cptr == NULL || iptr == NULL) + if (iptr == NULL) return CREDIS_ERR_NOMEM; mb->bulks = cptr;