Fix valgrind warnings

This commit is contained in:
Benau 2020-08-24 00:58:11 +08:00
parent dc0a5a9c66
commit 7b4d1dca6b

View File

@ -17,6 +17,7 @@
#include <SBConfig.h> #include <SBConfig.h>
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "BidiChain.h" #include "BidiChain.h"
#include "BidiTypeLookup.h" #include "BidiTypeLookup.h"
@ -54,6 +55,7 @@ static ParagraphContextRef CreateParagraphContext(const SBBidiType *types, SBLev
const SBUInteger offsetTypes = offsetLinks + sizeLinks; const SBUInteger offsetTypes = offsetLinks + sizeLinks;
SBUInt8 *memory = (SBUInt8 *)malloc(sizeMemory); SBUInt8 *memory = (SBUInt8 *)malloc(sizeMemory);
memset(memory, 0, sizeMemory);
ParagraphContextRef context = (ParagraphContextRef)(memory + offsetContext); ParagraphContextRef context = (ParagraphContextRef)(memory + offsetContext);
BidiLink *fixedLinks = (BidiLink *)(memory + offsetLinks); BidiLink *fixedLinks = (BidiLink *)(memory + offsetLinks);
SBBidiType *fixedTypes = (SBBidiType *)(memory + offsetTypes); SBBidiType *fixedTypes = (SBBidiType *)(memory + offsetTypes);