Skip to content

Commit

Permalink
Avoid DEBUG POPULATE crash at dictExpand OOM (#12363)
Browse files Browse the repository at this point in the history
Change to use dictTryExpand, return error on OOM.
  • Loading branch information
enjoy-binbin committed Jul 1, 2023
1 parent 6bf9b14 commit 2617412
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,10 @@ NULL
if (getPositiveLongFromObjectOrReply(c, c->argv[2], &keys, NULL) != C_OK)
return;

dictExpand(c->db->dict,keys);
if (dictTryExpand(c->db->dict, keys) != DICT_OK) {
addReplyError(c, "OOM in dictTryExpand");
return;
}
long valsize = 0;
if ( c->argc == 5 && getPositiveLongFromObjectOrReply(c, c->argv[4], &valsize, NULL) != C_OK )
return;
Expand Down

0 comments on commit 2617412

Please sign in to comment.