diff --git a/src/module.c b/src/module.c index e3a7bb857..2dd6c9b63 100644 --- a/src/module.c +++ b/src/module.c @@ -747,7 +747,7 @@ int RM_StringTruncate(RedisModuleKey *key, size_t newlen) { } else if (newlen < curlen) { sdsrange(key->value->ptr,0,newlen-1); /* If the string is too wasteful, reallocate it. */ - if (sdslen(key->value->ptr) > sdsavail(key->value->ptr)) + if (sdslen(key->value->ptr) < sdsavail(key->value->ptr)) key->value->ptr = sdsRemoveFreeSpace(key->value->ptr); } return REDISMODULE_OK;