Closed Bug 603326 Opened 9 years ago Closed 8 years ago

CPPpragma mishandles/leaks allTokens

Categories

(Core :: Graphics, defect, minor)

defect
Not set
minor

Tracking

()

RESOLVED WONTFIX

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, memory-leak)

Attachments

(1 file)

566 static int CPPpragma(yystypepp * yylvalpp)
567 {

alloc:
584         allTokens = (char**)malloc(sizeof(char*) * maxTokenCount);      

586         while (token != '\n') {

mishandle realloc (you need to use a temporary and compare against null to decide if it succeeded):
589                         allTokens = (char**)realloc((char**)allTokens, sizeof(char*) * maxTokenCount);
590                 }


591                 switch (token) {
592                 case CPP_IDENTIFIER:
597                 case CPP_INTCONSTANT:
602                 case CPP_FLOATCONSTANT:
606                         break;
607                 case -1:
608             // EOF
609             CPPShInfoLogMsg("#pragma directive must end with a newline");                       

allTokens is leaked here:
610                         return token;
Attached patch patchSplinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Needs to be filed at http://code.google.com/p/angleproject/ -- please file further ANGLE bugs there.
This has been marked as accepted on the angle bug tracker, we don't need to patch this locally.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.