From 63e471d902763e2899c5dccd64c4f9c67284d6a1 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Tue, 13 Oct 2020 19:16:25 -0300 Subject: [PATCH] Correctly return the output patch's size in Picture_PatchConvert --- src/r_picformats.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/r_picformats.c b/src/r_picformats.c index 8ec78663e..ffef4c2f2 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -352,20 +352,26 @@ void *Picture_PatchConvert( img = Z_Malloc(size, PU_STATIC, NULL); memcpy(img, imgbuf, size); - if (outsize != NULL) - *outsize = size; - if (Picture_IsInternalPatchFormat(outformat)) { patch_t *converted = Patch_Create((softwarepatch_t *)img, size, NULL); + #ifdef HWRENDER Patch_CreateGL(converted); #endif + Z_Free(img); + + if (outsize != NULL) + *outsize = sizeof(patch_t); return converted; } else + { + if (outsize != NULL) + *outsize = size; return img; + } } /** Converts a picture to a flat.