Added a sanity check during free when compiled without -DNDEBUG.

There might be liftime issues with the allocated memory when copying
a pool. Therefore I added a check whether the memory was actually
allocated by the pool when freeing it.
Fixed the free call in the test.

oelements stores longs which need to be converted to pointers before freeing.
Previously we actually free the entries of the array oelements and not the
stored pointers.
Only check for bad_alloc with -DNDEBUG.