Skip to content

Commit 1aa1941

Browse files
author
Steve Naroff
committed
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
1 parent dc5b4c5 commit 1aa1941

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

clang/include/clang/Parse/DeclSpec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ class Declarator {
566566
}
567567
DeclTypeInfo.clear();
568568
delete AttrList;
569+
AttrList = 0;
569570
}
570571

571572
/// mayOmitIdentifier - Return true if the identifier is either optional or

clang/test/Sema/declspec.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ typedef char T[4];
33

44
T foo(int n, int m) { } // expected-error {{cannot return array or function}}
55

6+
void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf (void);
7+
8+

0 commit comments

Comments
 (0)