diff options
author | Steve Naroff <snaroff@apple.com> | 2008-01-17 00:36:28 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-01-17 00:36:28 +0000 |
commit | 1aa1941889e08cf84e9fa392f1697522ab9a7ec6 (patch) | |
tree | 06e2e7919ae08190efb024a99a65558089b4be20 | |
parent | dc5b4c57d728fd37627810f6937c5f746e831413 (diff) | |
download | llvm-1aa1941889e08cf84e9fa392f1697522ab9a7ec6.zip llvm-1aa1941889e08cf84e9fa392f1697522ab9a7ec6.tar.gz llvm-1aa1941889e08cf84e9fa392f1697522ab9a7ec6.tar.bz2 |
Declarator::clear(): Null out variable after it's been deleted.
This avoids a double free (which is good:-)
Bug submitted by Eli.
llvm-svn: 46105
-rw-r--r-- | clang/include/clang/Parse/DeclSpec.h | 1 | ||||
-rw-r--r-- | clang/test/Sema/declspec.c | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/clang/include/clang/Parse/DeclSpec.h b/clang/include/clang/Parse/DeclSpec.h index bf7920f..307959f 100644 --- a/clang/include/clang/Parse/DeclSpec.h +++ b/clang/include/clang/Parse/DeclSpec.h @@ -566,6 +566,7 @@ public: } DeclTypeInfo.clear(); delete AttrList; + AttrList = 0; } /// mayOmitIdentifier - Return true if the identifier is either optional or diff --git a/clang/test/Sema/declspec.c b/clang/test/Sema/declspec.c index d9e02ec..05f492d 100644 --- a/clang/test/Sema/declspec.c +++ b/clang/test/Sema/declspec.c @@ -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); + + |