0

Error Memory leak

Why does my code has an memory leak on the copy constructor and the passed in constructor. https://code.sololearn.com/c7H3CTZ2mIKX/?ref=app

24th Apr 2022, 2:25 AM
Yones Mussa
3 Answers
0
Since program does nothing, it has no leak. If you attempt to delete storage that was not allocate by new using the first constructor, you will get an error on the delete.
24th Apr 2022, 3:22 AM
John Wells
John Wells - avatar
0
John Wells i tried to check of the array is equal to null ptr then delete on my destructor but still have a memory leak. My code works just fine but its telling me that on the copy and passed in constructor had a leak for some reason. If i delete the orginal one after copying it, it wouldnt copy anything?
24th Apr 2022, 9:16 AM
Yones Mussa
0
Can you show that code so I can duplicate it? At the moment, it does nothing.
24th Apr 2022, 11:29 AM
John Wells
John Wells - avatar