Skip to content
Snippets Groups Projects
Commit 2cde0e98 authored by Oliver Sander's avatar Oliver Sander
Browse files

check whether assignment from a null pointer properly deallocates memory

[[Imported from SVN: r6470]]
parent 24a898c3
No related branches found
No related tags found
No related merge requests found
......@@ -184,6 +184,15 @@ int main(){
ret=1;
}
// test assignment from null ptr
// (should trigger FS 936, needs valgrind to check)
{
shared_ptr<int> foo = shared_ptr<int>(new int(42));
shared_ptr<int> bar; //null ptr
foo = bar; // should release memory held by foo
}
// test shared_ptr for stack allocation
{
int i = 10;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment