Don't zero out potentially long buffers
Former-commit-id: 91e76ab4a00546278100baf6dfe61c13e802b40e
This commit is contained in:
parent
f695e2e26c
commit
8210d67c24
@ -102,10 +102,11 @@ robj *createEmbeddedStringObject(const char *ptr, size_t len) {
|
|||||||
allocsize = sizeof(void*);
|
allocsize = sizeof(void*);
|
||||||
|
|
||||||
size_t mvccExtraBytes = g_pserver->fActiveReplica ? sizeof(redisObjectExtended) : 0;
|
size_t mvccExtraBytes = g_pserver->fActiveReplica ? sizeof(redisObjectExtended) : 0;
|
||||||
char *oB = (char*)zcalloc(sizeof(robj)+allocsize-sizeof(redisObject::m_ptr)+mvccExtraBytes, MALLOC_SHARED);
|
char *oB = (char*)zmalloc(sizeof(robj)+allocsize-sizeof(redisObject::m_ptr)+mvccExtraBytes, MALLOC_SHARED);
|
||||||
robj *o = reinterpret_cast<robj*>(oB + mvccExtraBytes);
|
robj *o = reinterpret_cast<robj*>(oB + mvccExtraBytes);
|
||||||
struct sdshdr8 *sh = (sdshdr8*)(&o->m_ptr);
|
struct sdshdr8 *sh = (sdshdr8*)(&o->m_ptr);
|
||||||
|
|
||||||
|
new (o) redisObject;
|
||||||
o->type = OBJ_STRING;
|
o->type = OBJ_STRING;
|
||||||
o->encoding = OBJ_ENCODING_EMBSTR;
|
o->encoding = OBJ_ENCODING_EMBSTR;
|
||||||
o->setrefcount(1);
|
o->setrefcount(1);
|
||||||
|
@ -950,6 +950,7 @@ struct redisObjectExtended {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef struct redisObject {
|
typedef struct redisObject {
|
||||||
|
friend redisObject *createEmbeddedStringObject(const char *ptr, size_t len);
|
||||||
protected:
|
protected:
|
||||||
redisObject() {}
|
redisObject() {}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user