mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
modules/RM_StringTruncate: correct reallocate condition
This commit is contained in:
parent
3a7b170205
commit
2e464bf0b1
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user