Problem: Valgrind reports read of freed memory
Solution: when iterating over a map and conditionally deleting elements, an erased iterator gets invalidated. Call erase using postfix increment on iterator to avoid using an invalid element in the next iteration.
Showing
Please
register
or
sign in
to comment