Skip to content

Commit 2df73fd

Browse files
committed
Fix in rdb loading
1 parent 0616eeb commit 2df73fd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/execution/command_parser.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -500,14 +500,16 @@ int ParseModelSetCommand(RedisModuleString **argv, int argc, RAI_Model *model, R
500500
}
501501
model->backend = backend;
502502

503-
// Parse <backend> argument: check that the device string is "CPU", "GPU" or
504-
// "GPU:<n>" where <n> is a number (contains digits only).
503+
// Parse <backend> argument: check that the device string is "CPU", "GPU",
504+
// "GPU:<n>" or "GPU:<n>, where <n> is a number (contains digits only).
505505
const char *device_str;
506506
AC_GetString(&ac, &device_str, NULL, 0);
507507
bool valid_device = false;
508508
if (strcasecmp(device_str, "CPU") == 0 || strcasecmp(device_str, "GPU") == 0) {
509509
valid_device = true;
510-
} else if (strncasecmp(device_str, "GPU:", 4) == 0 && strlen(device_str) <= 10) {
510+
} else if ((strncasecmp(device_str, "GPU:", 4) == 0 ||
511+
strncasecmp(device_str, "CPU:", 4) == 0) &&
512+
strlen(device_str) <= 10) {
511513
bool digits_only = true;
512514
for (size_t i = 5; i < strlen(device_str); i++) {
513515
if (device_str[i] < '0' || device_str[i] > '9') {

src/serialization/RDB/decoder/current/v1/decode_v1.c

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ void *RAI_RDBLoadModel_v1(RedisModuleIO *io) {
135135
}
136136

137137
RAI_Model *model = RedisModule_Calloc(1, sizeof(*model));
138+
model->refCount = 1;
138139
model->infokey = RAI_HoldString(NULL, key_str);
139140
model->backend = backend;
140141
model->devicestr = devicestr;

0 commit comments

Comments
 (0)