Skip to content

Commit

Permalink
[svn] MOJOSHADER_parseData needs to hold app-defined allocators even …
Browse files Browse the repository at this point in the history
…when there's

 an error, so we use the right free() when they are down with the object.

--HG--
branch : trunk
  • Loading branch information
icculus committed Mar 28, 2008
1 parent e92cc01 commit 8537474
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mojoshader.c
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 8537474

Please sign in to comment.