diff src/alloc.c @ 4776:73e8632018ad

Don't attempt to free dumped data, alloc.c:resize_string() 2009-12-17 Aidan Kehoe <kehoea@parhasard.net> * alloc.c (resize_string): Don't attempt to free dumped data in this function, avoiding an assertion failure.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 17 Dec 2009 13:15:04 +0000
parents 80d74fed5399
children 5d120deb60ca e0db3c197671
line wrap: on
line diff
--- a/src/alloc.c	Thu Dec 17 12:57:38 2009 +0000
+++ b/src/alloc.c	Thu Dec 17 13:15:04 2009 +0000
@@ -2690,19 +2690,20 @@
 	    }
 	  XSET_STRING_DATA (s, new_data);
 
-	  {
-	    /* We need to mark this chunk of the string_chars_block
-	       as unused so that compact_string_chars() doesn't
-	       freak. */
-	    struct string_chars *old_s_chars = (struct string_chars *)
-	      ((char *) old_data - offsetof (struct string_chars, chars));
-	    /* Sanity check to make sure we aren't hosed by strange
-	       alignment/padding. */
-	    assert (old_s_chars->string == XSTRING (s));
-	    MARK_STRING_CHARS_AS_FREE (old_s_chars);
-	    ((struct unused_string_chars *) old_s_chars)->fullsize =
-	      oldfullsize;
-	  }
+	  if (!DUMPEDP (old_data)) /* Can't free dumped data. */
+	    {
+	      /* We need to mark this chunk of the string_chars_block
+		 as unused so that compact_string_chars() doesn't
+		 freak. */
+	      struct string_chars *old_s_chars = (struct string_chars *)
+		((char *) old_data - offsetof (struct string_chars, chars));
+	      /* Sanity check to make sure we aren't hosed by strange
+		 alignment/padding. */
+	      assert (old_s_chars->string == XSTRING (s));
+	      MARK_STRING_CHARS_AS_FREE (old_s_chars);
+	      ((struct unused_string_chars *) old_s_chars)->fullsize =
+                  oldfullsize;
+	    }
 	}
     }
 #endif /* not NEW_GC */