Revisited the code dealing with SW breakpoint and the related stuff

Fixed use-after-frees on deletion of sw_used and sw_active, several memory leaks, etc.
Many other improvements have been made, see the commits for full details.