brandon-a / CIS-22C-Group-Project

Using different data structures to organize USDA nutritional facts.
0 stars 0 forks source link

Double deletion #14

Closed theorangepotato closed 8 years ago

theorangepotato commented 8 years ago

When a food is deleted in the program, upon quitting I get an error saying that something is being released to memory more than once. Be on the look out for the reason for the bug.

theorangepotato commented 8 years ago

Also, are we even deleting the Food objects at the end of the program?

theorangepotato commented 8 years ago

Neither of the test drivers, HashTEST.cpp and BinaryTEST.cpp, give the error, and both use the deletion. So my guess is it's either a problem with the secKey BST, or the Stack (However, my test drivers aren't very intense). Very possibly a pointer that should point to NULL but ends up not, or should point to different node.

theorangepotato commented 8 years ago

Here is the exact error message, for reference.

* Error in `./compiled': double free or corruption (fasttop): 0x0000000001db2f10 * Aborted

'./compiled' is the name of the compiled program. Full test case (42188 is a valid Food object):

USDA Nutritional Facts Management System

BY: Jasmin Adzic Brandon Archbold Austin Bohannon Ahmed Shalan Mikhail Smelik

List of Menu options

A - Add New Data D - Delete Data by key number S - Search by unique key or item name P - Special Print U - Undo Delete W - Write Data to File T - Statsitics Q - Quit Program

Choice: d Enter a value: 42188

List of Menu options

A - Add New Data D - Delete Data by key number S - Search by unique key or item name P - Special Print U - Undo Delete W - Write Data to File T - Statsitics Q - Quit Program

Choice: q

List of Menu options

A - Add New Data D - Delete Data by key number S - Search by unique key or item name P - Special Print U - Undo Delete W - Write Data to File T - Statsitics Q - Quit Program * Error in `./compiled': double free or corruption (fasttop): 0x0000000001db2f10 * Aborted

theorangepotato commented 8 years ago

It doesn't seem to happen if I undo the delete. Also, the error seems to be in a memory address right next to the deleted item.

Trial 1:

Choice: d 42188 Enter a value: 42188 Pointer: 0x20bf770

* Error in `./compiled': double free or corruption (fasttop): 0x00000000020bff10 * Aborted

Trial 2:

Choice: d Enter a value: 42188 Pointer: 0x208a770 * Error in `./compiled': double free or corruption (fasttop): 0x000000000208af10 * Aborted

Trial 3:

Choice: d Enter a value: 42188 Pointer: 0x24db770

* Error in `./compiled': double free or corruption (fasttop): 0x00000000024dbf10 * Aborted

Trial 4 (different Food item):

Choice: d 42186 Enter a value: 42186 Pointer: 0x1b5b6e0

* Error in `./compiled': double free or corruption (fasttop): 0x0000000001b5cf10 * Aborted