antirez/redis — Issue #373: memory leak in sdssplitlen()
Author: drmckay
Created: 2012-03-07 11:42:39+00:00
State: open

Hi,

There is a memory leak in:

sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count) {
int elements = 0, slots = 5, start = 0, j;

sds *tokens = malloc(sizeof(sds)*slots);
#ifdef SDS_ABORT_ON_OOM
if (tokens == NULL) sdsOomAbort();
#endif
if (seplen < 1 || len < 0 || tokens == NULL) return NULL; <<--- here if malloc() doesn't fails missing free()

Peter