]> granicus.if.org Git - clang/commitdiff
Declarator::clear(): Null out variable after it's been deleted.
authorSteve Naroff <snaroff@apple.com>
Thu, 17 Jan 2008 00:36:28 +0000 (00:36 +0000)
committerSteve Naroff <snaroff@apple.com>
Thu, 17 Jan 2008 00:36:28 +0000 (00:36 +0000)
This avoids a double free (which is good:-)

Bug submitted by Eli.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46105 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/DeclSpec.h
test/Sema/declspec.c

index bf7920fa2d2f462f3e491f609122e0175a6a8344..307959f83a471ed612582d110a6b9327a94355ad 100644 (file)
@@ -566,6 +566,7 @@ public:
     }
     DeclTypeInfo.clear();
     delete AttrList;
+    AttrList = 0;
   }
   
   /// mayOmitIdentifier - Return true if the identifier is either optional or
index d9e02ec42e13ccf7d0392494cb587382c56c2180..05f492d67ac032f824b239bcd7eb23cc6a5916e5 100644 (file)
@@ -3,3 +3,6 @@ typedef char T[4];
 
 T foo(int n, int m) {  }  // expected-error {{cannot return array or function}}
 
+void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf (void);
+
+