From 853747483db936d527cf0c4ea4cc263716472859 Mon Sep 17 00:00:00 2001 From: icculus Date: Thu, 27 Mar 2008 23:07:44 -0400 Subject: [PATCH] [svn] MOJOSHADER_parseData needs to hold app-defined allocators even when there's an error, so we use the right free() when they are down with the object. --HG-- branch : trunk --- mojoshader.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mojoshader.c b/mojoshader.c index 23241ee3..33720ccc 100644 --- a/mojoshader.c +++ b/mojoshader.c @@ -2602,7 +2602,7 @@ static MOJOSHADER_parseData *build_parsedata(Context *ctx) if (isfail(ctx)) { if (output != NULL) - ctx->free(output); // just in case. + ctx->free(output); retval->error = ctx->failstr; // we recycle. :) ctx->failstr = NULL; // don't let this get free()'d too soon. } // if @@ -2614,10 +2614,11 @@ static MOJOSHADER_parseData *build_parsedata(Context *ctx) retval->shader_type = ctx->shader_type; retval->major_ver = (int) ctx->major_ver; retval->minor_ver = (int) ctx->minor_ver; - retval->malloc = (ctx->malloc == internal_malloc) ? NULL : ctx->malloc; - retval->free = (ctx->free == internal_free) ? NULL : ctx->free; } // else + retval->malloc = (ctx->malloc == internal_malloc) ? NULL : ctx->malloc; + retval->free = (ctx->free == internal_free) ? NULL : ctx->free; + return retval; } // build_parsedata