mojoshader_common.c
changeset 1059 9655c606b39d
parent 965 6284deccb61e
child 1064 d3f0f4cf84f2
--- a/mojoshader_common.c	Mon Aug 01 15:14:50 2011 -0400
+++ b/mojoshader_common.c	Thu Oct 20 12:08:12 2011 -0400
@@ -250,7 +250,17 @@
     int rc = -1;
     char *k = (char *) smap->m(strlen(key) + 1, smap->d);
     char *v = (char *) (value ? smap->m(strlen(value) + 1, smap->d) : NULL);
-    if ( (!k) || ((!v) && (value)) || ((rc = hash_insert(smap, k, v)) <= 0) )
+    int failed = ( (!k) || ((!v) && (value)) );
+
+    if (!failed)
+    {
+        strcpy(k, key);
+        if (value != NULL)
+            strcpy(v, value);
+        failed = ((rc = hash_insert(smap, k, v)) <= 0);
+    } // if
+
+    if (failed)
     {
         smap->f(k, smap->d);
         smap->f(v, smap->d);