diff options
author | Bruce Merry <bmerry@gmail.com> | 2018-09-29 21:48:08 +0200 |
---|---|---|
committer | Bruce Merry <bmerry@gmail.com> | 2018-09-30 11:32:48 +0200 |
commit | ecc48369ce2f890922e462bfe82e4e26cbb8beba (patch) | |
tree | 4710b22dff4940c91946ee238835b8f668d19ae7 | |
parent | 1d6711a7645cd11bea2e55a438e7a25891117cd6 (diff) | |
download | redis-ecc48369ce2f890922e462bfe82e4e26cbb8beba.tar.gz |
Fix invalid use of sdsZmallocSize on an embedded string
sdsZmallocSize assumes a dynamically allocated SDS. When given a string
object created by createEmbeddedStringObject, it calls zmalloc_size on a
pointer that isn't the one returned by zmalloc
-rw-r--r-- | src/scripting.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/scripting.c b/src/scripting.c index 73337c718..979156037 100644 --- a/src/scripting.c +++ b/src/scripting.c @@ -1221,7 +1221,7 @@ sds luaCreateFunction(client *c, lua_State *lua, robj *body) { * EVALSHA commands as EVAL using the original script. */ int retval = dictAdd(server.lua_scripts,sha,body); serverAssertWithInfo(c ? c : server.lua_client,NULL,retval == DICT_OK); - server.lua_scripts_mem += sdsZmallocSize(sha) + sdsZmallocSize(body->ptr); + server.lua_scripts_mem += sdsZmallocSize(sha) + getStringObjectSdsUsedMemory(body); incrRefCount(body); return sha; } |