Don't zero out potentially long buffers

Former-commit-id: 91e76ab4a00546278100baf6dfe61c13e802b40e
This commit is contained in:
John Sully 2021-09-10 00:38:49 +00:00
parent f695e2e26c
commit 8210d67c24
2 changed files with 3 additions and 1 deletions

View File

@ -102,10 +102,11 @@ robj *createEmbeddedStringObject(const char *ptr, size_t len) {
allocsize = sizeof(void*);
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);
struct sdshdr8 *sh = (sdshdr8*)(&o->m_ptr);
new (o) redisObject;
o->type = OBJ_STRING;
o->encoding = OBJ_ENCODING_EMBSTR;
o->setrefcount(1);

View File

@ -950,6 +950,7 @@ struct redisObjectExtended {
};
typedef struct redisObject {
friend redisObject *createEmbeddedStringObject(const char *ptr, size_t len);
protected:
redisObject() {}