Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1710419

Browse files
Protect against a memory leak if we're serializing HMSET values
1 parent 3491b18 commit 1710419

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

redis_commands.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -1596,12 +1596,14 @@ int redis_hmset_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
15961596
}
15971597

15981598
// Serialize value (if directed)
1599-
val_free = redis_serialize(redis_sock, *z_val, &val, &val_len
1600-
TSRMLS_CC);
1599+
val_free = redis_serialize(redis_sock, *z_val, &val, &val_len TSRMLS_CC);
16011600

16021601
// Append the key and value to our command
16031602
redis_cmd_append_sstr(&cmdstr, mem, mem_len);
16041603
redis_cmd_append_sstr(&cmdstr, val, val_len);
1604+
1605+
// Free our value if we serialized it
1606+
if (val_free) STR_FREE(val);
16051607
}
16061608

16071609
// Set slot if directed

0 commit comments

Comments
 (0)