From f264e957a436f633051efb1e2721bab5342b276e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 21 Dec 2008 05:06:05 -0500 Subject: [PATCH] Fixed NULL pointer dereference. --- mojoshader_assembler.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mojoshader_assembler.c b/mojoshader_assembler.c index 6429315b..18fa0699 100644 --- a/mojoshader_assembler.c +++ b/mojoshader_assembler.c @@ -1712,8 +1712,11 @@ static uint32 add_ctab_bytes(Context *ctx, const uint8 *bytes, const size_t len) void *ptr = Malloc(ctx, ctx->ctab_allocation); if (ptr == NULL) return 0; - memcpy(ptr, ctx->ctab, ctx->ctab_len); - Free(ctx, ctx->ctab); + if (ctx->ctab != NULL) + { + memcpy(ptr, ctx->ctab, ctx->ctab_len); + Free(ctx, ctx->ctab); + } // if ctx->ctab = (uint8 *) ptr; } // if