[llvm-commits] [llvm-gcc-4.2] r52331 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

Dale Johannesen dalej at apple.com
Mon Jun 16 10:03:00 PDT 2008


Author: johannes
Date: Mon Jun 16 12:03:00 2008
New Revision: 52331

URL: http://llvm.org/viewvc/llvm-project?rev=52331&view=rev
Log:
Fix a use-after-free bug in ObjC FE.


Modified:
    llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=52331&r1=52330&r2=52331&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Jun 16 12:03:00 2008
@@ -2383,6 +2383,7 @@
   bool hasUnion, bytesSkipped;
   int num_nibbles = 0;
   bool first_nibble = true;
+  tree retval;
 
   if (!flag_objc_gc || !implementation_template)
     return NULL_TREE;
@@ -2559,12 +2560,13 @@
     }
   OUTPUT_LAYOUT_BYTE (0);  /* null terminate string */
   string = obstack_finish (&util_obstack);
-  obstack_free (&util_obstack, util_firstobj);
   /* if ivar_layout bitmap is all 1 bits (nothing skipped) then use NULL as
      final layout. */
-  return (strong_ivar_layout && !bytesSkipped) 
+  retval = (strong_ivar_layout && !bytesSkipped) 
 	   ? NULL_TREE 
 	   : add_objc_string (get_identifier (string), class_names);
+  obstack_free (&util_obstack, util_firstobj);
+  return retval;
 }
 
 /**





More information about the llvm-commits mailing list