Fixed #5167: Memory leak in unit test.
This commit is contained in:
parent
7bc69cd61e
commit
6a175d588f
@ -771,28 +771,29 @@ static BOOL fuzzyCompareImage(const UINT32 *refImage, const BYTE *img, size_t np
|
||||
|
||||
int TestFreeRDPCodecRemoteFX(int argc, char* argv[])
|
||||
{
|
||||
REGION16 region;
|
||||
RFX_CONTEXT* context;
|
||||
BYTE *dest;
|
||||
int rc = -1;
|
||||
REGION16 region = { 0 };
|
||||
RFX_CONTEXT* context = NULL;
|
||||
BYTE *dest = NULL;
|
||||
size_t stride = FORMAT_SIZE * IMG_WIDTH;
|
||||
|
||||
context = rfx_context_new(FALSE);
|
||||
if (!context)
|
||||
return -1;
|
||||
goto fail;
|
||||
|
||||
dest = calloc(IMG_WIDTH * IMG_HEIGHT, FORMAT_SIZE);
|
||||
if (!dest)
|
||||
return -2;
|
||||
goto fail;
|
||||
|
||||
region16_init(®ion);
|
||||
if (!rfx_process_message(context, encodeHeaderSample, sizeof(encodeHeaderSample), 0, 0, dest, FORMAT,
|
||||
stride, IMG_HEIGHT, ®ion))
|
||||
return -3;
|
||||
goto fail;
|
||||
|
||||
region16_clear(®ion);
|
||||
if(!rfx_process_message(context, encodeDataSample, sizeof(encodeDataSample), 0, 0, dest, FORMAT,
|
||||
stride, IMG_HEIGHT, ®ion))
|
||||
return -4;
|
||||
goto fail;
|
||||
region16_print(®ion);
|
||||
|
||||
#if 0
|
||||
@ -802,7 +803,12 @@ int TestFreeRDPCodecRemoteFX(int argc, char* argv[])
|
||||
#endif
|
||||
|
||||
if (!fuzzyCompareImage(refImage, dest, IMG_WIDTH * IMG_HEIGHT))
|
||||
return -5;
|
||||
goto fail;
|
||||
|
||||
return 0;
|
||||
rc = 0;
|
||||
fail:
|
||||
region16_uninit(®ion);
|
||||
rfx_context_free(context);
|
||||
free(dest);
|
||||
return rc;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user