mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Merge pull request #1764 from michael-grunder/lua_cache_segfault
Fix LUA_OBJCACHE segfault.
This commit is contained in:
commit
ce7c47265b
@ -237,7 +237,9 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
|
|||||||
if (obj_s == NULL) break; /* Not a string. */
|
if (obj_s == NULL) break; /* Not a string. */
|
||||||
|
|
||||||
/* Try to use a cached object. */
|
/* Try to use a cached object. */
|
||||||
if (cached_objects[j] && cached_objects_len[j] >= obj_len) {
|
if (j < LUA_CMD_OBJCACHE_SIZE && cached_objects[j] &&
|
||||||
|
cached_objects_len[j] >= obj_len)
|
||||||
|
{
|
||||||
char *s = cached_objects[j]->ptr;
|
char *s = cached_objects[j]->ptr;
|
||||||
struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr)));
|
struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr)));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user