Could it be that your methods return Book() when nothing is found when more realistically they should be returning NULL? I don't really feel like running through all the source to determine the memory leak. Just carefully check out everytime you allocate memory and determine if it is necessary and if you manage it.
Actually looking through the merge code it appears the code expects all returns from the get to be non-null. So you may not be able to do that. Not entirely sure what the purpose of the first loop is in the merge code, though. Since add is guaranteed to have non-dupes I don't know why the code doesn't just instantiate a new catalog and add all items from cat1 and cat2 and return the result. *Shrug*
Actually looking through the merge code it appears the code expects all returns from the get to be non-null. So you may not be able to do that. Not entirely sure what the purpose of the first loop is in the merge code, though. Since add is guaranteed to have non-dupes I don't know why the code doesn't just instantiate a new catalog and add all items from cat1 and cat2 and return the result. *Shrug*
Last edited: