Hi,

I get the following "Invalid read error" on the part below.

103        if(counter_->decrement() == 0){
104            delete counter_;
105            if(pointee_) delete pointee_;
106        }
107        counter_ = src->counter_;
108        pointee_ = src->pointee_;

==3581== Invalid read of size 8
==3581==    at 0x401625: DefaultStorage<PSPIntSLLNode,
MutexCounter>::replace(DefaultStorage<PSPIntSLLNode, MutexCounter>*)
(PSP.h:107)
==3581==    by 0x401410: PSP<PSPIntSLLNode, MutexCounter,
DefaultStorage>::operator=(PSP<PSPIntSLLNode, MutexCounter,
DefaultStorage>&) (PSP.h:276)
==3581==    by 0x400C49: PSPIntSLList::~PSPIntSLList() (PSPIntSLList.cpp:11)
==3581==    by 0x4010FF: main (PSPIntSLList.cpp:59)
==3581==  Address 0x4c24150 is 48 bytes inside a block of size 56 free'd
==3581==    at 0x4A05A76: operator delete(void*) (vg_replace_malloc.c:387)
==3581==    by 0x401620: DefaultStorage<PSPIntSLLNode,
MutexCounter>::replace(DefaultStorage<PSPIntSLLNode, MutexCounter>*)
(PSP.h:105)
==3581==    by 0x401410: PSP<PSPIntSLLNode, MutexCounter,
DefaultStorage>::operator=(PSP<PSPIntSLLNode, MutexCounter,
DefaultStorage>&) (PSP.h:276)
==3581==    by 0x400C49: PSPIntSLList::~PSPIntSLList() (PSPIntSLList.cpp:11)
==3581==    by 0x4010FF: main (PSPIntSLList.cpp:59)
==3581==
==3581== Invalid read of size 8
==3581==    at 0x401635: DefaultStorage<PSPIntSLLNode,
MutexCounter>::replace(DefaultStorage<PSPIntSLLNode, MutexCounter>*)
(PSP.h:108)
==3581==    by 0x401410: PSP<PSPIntSLLNode, MutexCounter,
DefaultStorage>::operator=(PSP<PSPIntSLLNode, MutexCounter,
DefaultStorage>&) (PSP.h:276)
==3581==    by 0x400C49: PSPIntSLList::~PSPIntSLList() (PSPIntSLList.cpp:11)
==3581==    by 0x4010FF: main (PSPIntSLList.cpp:59)
==3581==  Address 0x4c24148 is 40 bytes inside a block of size 56 free'd
==3581==    at 0x4A05A76: operator delete(void*) (vg_replace_malloc.c:387)
==3581==    by 0x401620: DefaultStorage<PSPIntSLLNode,
MutexCounter>::replace(DefaultStorage<PSPIntSLLNode, MutexCounter>*)
(PSP.h:105)
==3581==    by 0x401410: PSP<PSPIntSLLNode, MutexCounter,
DefaultStorage>::operator=(PSP<PSPIntSLLNode, MutexCounter,
DefaultStorage>&) (PSP.h:276)
==3581==    by 0x400C49: PSPIntSLList::~PSPIntSLList() (PSPIntSLList.cpp:11)
==3581==    by 0x4010FF: main (PSPIntSLList.cpp:59)

Both of pointee_ and counter_ are member fields of the class.
This error means pointee_ and counter_ are asigned at line 107 and 108 after
deletions at line 105(104), correct?

Thanks,
Takenori
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to