fixed potential memory leak

This commit is contained in:
Ende! 2015-03-19 19:30:25 +01:00
parent f94792e4f9
commit b93ddf848b
2 changed files with 52 additions and 0 deletions

View File

@ -526,6 +526,15 @@ VXBaseDataSourceContext* VXMemoryDataSource_Create(
if (!thiz || !ctx)
{
if (thiz)
{
free(thiz);
}
if (ctx)
{
free(ctx);
}
return NULL;
}
@ -614,6 +623,20 @@ VXBaseDataSourceContext* VXCustomDataSource_Create(
VXCustomDataSource *thiz = malloc(sizeof(VXCustomDataSource));
VXBaseDataSourceContext *ctx = malloc(sizeof(VXBaseDataSourceContext));
if (!thiz || !ctx)
{
if (thiz)
{
free(thiz);
}
if (ctx)
{
free(ctx);
}
return NULL;
}
ctx->d.type = TYPE_CUSTOMDATASOURCE;
ctx->d.ptr = thiz;
@ -656,6 +679,15 @@ VXInstructionDecoderContext* VXInstructionDecoder_CreateEx(VXBaseDataSourceConte
if (!thiz || !ctx)
{
if (thiz)
{
free(thiz);
}
if (ctx)
{
free(ctx);
}
return NULL;
}

View File

@ -325,6 +325,15 @@ VXBaseSymbolResolverContext* VXCustomSymbolResolver_Create(
if (!thiz || !ctx)
{
if (thiz)
{
free(thiz);
}
if (ctx)
{
free(ctx);
}
return NULL;
}
@ -807,7 +816,18 @@ VXBaseInstructionFormatterContext* VXIntelInstructionFormatter_CreateEx(
VXBaseInstructionFormatterContext *ctx = malloc(sizeof(VXBaseInstructionFormatterContext));
if (!thiz || !ctx)
{
if (thiz)
{
free(thiz);
}
if (ctx)
{
free(ctx);
}
return NULL;
}
ctx->d.type = TYPE_INTELINSTRUCTIONFORMATTER;
ctx->d.ptr = thiz;