Core: Fix memory leak when reloading mVL header
Vicki Pfau vi@endrift.com
Mon, 24 Apr 2017 14:00:59 -0700
1 files changed,
7 insertions(+),
0 deletions(-)
jump to
M
src/feature/video-logger.c
→
src/feature/video-logger.c
@@ -458,6 +458,8 @@ struct mVideoLogContext* context = malloc(sizeof(*context));
memset(context, 0, sizeof(*context)); context->write = !!core; + context->initialStateSize = 0; + context->initialState = NULL; if (core) { context->initialStateSize = core->stateSize(core);@@ -555,6 +557,11 @@ return false;
} if (header.blockType != mVL_BLOCK_INITIAL_STATE) { return false; + } + if (context->initialState) { + mappedMemoryFree(context->initialState, context->initialStateSize); + context->initialState = NULL; + context->initialStateSize = 0; } if (header.flags & mVL_FLAG_BLOCK_COMPRESSED) { #ifdef USE_ZLIB