|
![]() Click on image to see enlargment |
|
PC-lint/FlexeLint Output | Reference Manual Explanation | Home bug424.cpp
Charlie and Sandra, both programmers, decided to program the printing of their wedding announcements but did not use PC-lint or FlexeLint. The program of course bombed. What's going wrong? bug424.cpp lint Output
--- Module: bug424.cpp (C++)
_
delete p;
bug424.cpp(13) : Warning 424: Inappropriate deallocation (delete) for 'new[] or modified' data
Reference Manual Explanation
424 Inappropriate deallocation (Name1) for 'Name2' data. -- This message indicates
that a deallocation (free(), delete, or delete[]) as specified by Name1 is
inappropriate for the data being freed. [12, Item 5]
The kind of data (specified by Name2) is one or more of:
malloc, new, new[], static, auto, member, modified or constant.
These have the meanings as described below:
malloc data is data obtained from a call to malloc, calloc or realloc.
new and new[] data is data derived from calls to new.
static data is either static data within a function or external data.
auto data is non-static data in a function.
member data is a component of a structure (and hence can't be independently freed).
modified data is the result of applying pointer arithmetic to some other pointer. E.g.
p = malloc(100);
free( p+1 ); // warning
p+1 is considered modified.
constant data is the result of casting a constant to a pointer. E.g.
int *p = (int *) Ox80002;
free(p); // warning
If you have comments or questions about this bug, please post them to our Discussion Forum |
Previous Bug - Bug #1539 - May 2006