Skip to content

Commit

Permalink
Protect against a memory leak if we're serializing HMSET values
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-grunder committed May 8, 2015
1 parent 3491b18 commit 1710419
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions redis_commands.c
Expand Up @@ -1596,12 +1596,14 @@ int redis_hmset_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
}

// Serialize value (if directed)
val_free = redis_serialize(redis_sock, *z_val, &val, &val_len
TSRMLS_CC);
val_free = redis_serialize(redis_sock, *z_val, &val, &val_len TSRMLS_CC);

// Append the key and value to our command
redis_cmd_append_sstr(&cmdstr, mem, mem_len);
redis_cmd_append_sstr(&cmdstr, val, val_len);

// Free our value if we serialized it
if (val_free) STR_FREE(val);
}

// Set slot if directed
Expand Down

0 comments on commit 1710419

Please sign in to comment.