diff --git a/src/r_picformats.c b/src/r_picformats.c index 8ec78663ebcd965825338f2fb534e5db1f9cd3ac..ffef4c2f207718f7f53bc96edbc8b5945252b401 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.