mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Fix two minor bugs (MIGRATE key args and getKeysUsingCommandTable) (#9455)
1. MIGRATE has a potnetial key arg in argv[3]. It should be reflected in the command table. 2. getKeysUsingCommandTable should never free getKeysResult, it is always freed by the caller) The reason we never encountered this double-free bug is that almost always getKeysResult uses the statis buffer and doesn't allocate a new one.
This commit is contained in:
parent
306a5ccd2d
commit
6aa2285e32
1
src/db.c
1
src/db.c
@ -1614,7 +1614,6 @@ int getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, get
|
|||||||
* return no keys and expect the command implementation to report
|
* return no keys and expect the command implementation to report
|
||||||
* an arity or syntax error. */
|
* an arity or syntax error. */
|
||||||
if (cmd->flags & CMD_MODULE || cmd->arity < 0) {
|
if (cmd->flags & CMD_MODULE || cmd->arity < 0) {
|
||||||
getKeysFreeResult(result);
|
|
||||||
result->numkeys = 0;
|
result->numkeys = 0;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -891,7 +891,7 @@ struct redisCommand redisCommandTable[] = {
|
|||||||
|
|
||||||
{"migrate",migrateCommand,-6,
|
{"migrate",migrateCommand,-6,
|
||||||
"write random @keyspace @dangerous",
|
"write random @keyspace @dangerous",
|
||||||
0,migrateGetKeys,0,0,0,0,0,0},
|
0,migrateGetKeys,3,3,1,0,0,0},
|
||||||
|
|
||||||
{"asking",askingCommand,1,
|
{"asking",askingCommand,1,
|
||||||
"fast @connection",
|
"fast @connection",
|
||||||
|
Loading…
Reference in New Issue
Block a user