Avoid DEBUG POPULATE crash at dictExpand OOM (#12363)

Change to use dictTryExpand, return error on OOM.
This commit is contained in:
Binbin 2023-07-01 22:35:35 +08:00 committed by GitHub
parent 6bf9b144ef
commit 26174123ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;