mojoshader.c
branchtrunk
changeset 251 290378a53579
parent 250 b75c08291021
child 252 59a608b65a0a
--- a/mojoshader.c	Tue Apr 29 20:33:02 2008 -0400
+++ b/mojoshader.c	Tue Apr 29 20:39:04 2008 -0400
@@ -4691,17 +4691,26 @@
 
         Free(ctx, output);
 
-        for (i = 0; i < ctx->uniform_count; i++)
-            Free(ctx, (void *) uniforms[i].name);
-        Free(ctx, uniforms);
-
-        for (i = 0; i < attribute_count; i++)
-            Free(ctx, (void *) attributes[i].name);
-        Free(ctx, attributes);
-
-        for (i = 0; i < ctx->sampler_count; i++)
-            Free(ctx, (void *) samplers[i].name);
-        Free(ctx, samplers);
+        if (uniforms != NULL)
+        {
+            for (i = 0; i < ctx->uniform_count; i++)
+                Free(ctx, (void *) uniforms[i].name);
+            Free(ctx, uniforms);
+        } // if
+
+        if (attributes != NULL)
+        {
+            for (i = 0; i < attribute_count; i++)
+                Free(ctx, (void *) attributes[i].name);
+            Free(ctx, attributes);
+        } // if
+
+        if (samplers != NULL)
+        {
+            for (i = 0; i < ctx->sampler_count; i++)
+                Free(ctx, (void *) samplers[i].name);
+            Free(ctx, samplers);
+        } // if
 
         retval->error = ctx->failstr;  // we recycle.  :)
         ctx->failstr = NULL;  // don't let this get free()'d too soon.