http://llvm.org/bugs/show_bug.cgi?id=13751
Bug #: 13751
Summary: vector push_back strdup: Memory is never released
Product: clang
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 9143
--> http://llvm.org/bugs/attachment.cgi?id=9143
Preprocessed file with stl from gcc 4.7
#include <vector>
#include <algorithm>
#include <string.h>
class a
{
public:
~a()
{
for (size_t i = 0; i < args_.size(); ++i)
{
std::free(args_[i]);
}
}
void append(const char *arg)
{
char *newArg = strdup(arg);
args_.push_back(newArg);
}
private:
std::vector<char *> args_;
};
int main()
{
a i;
i.append("a");
}
gives
test6.cc:28:5: warning: Memory is never released; potential leak of memory
pointed to by 'newArg'
i.append("a");
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs