Fixed NULL pointer dereference.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 21 Dec 2008 05:06:05 -0500
changeset 526 ba7df2cd0371
parent 525 0493d39de79a
child 527 7bc4c80ef02c
Fixed NULL pointer dereference.
mojoshader_assembler.c
--- a/mojoshader_assembler.c	Sun Dec 21 00:08:00 2008 -0500
+++ b/mojoshader_assembler.c	Sun Dec 21 05:06:05 2008 -0500
@@ -1712,8 +1712,11 @@
         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