It turns out that there is another function with almost identical loop. This time, in 'update_solib_list' gdb would do the same: in one iteration it frees an objfile, in another tries to free it again. The attached patch supersedes the first one and extracts the logic for determining duplicates into a function, then uses the function. Still no regressions. Comments appreciated. Thanks, Aleksandar Ristovski QNX Software Systems ChangeLog has changed slightly: Aleksandar Ristovski * solib.c (used): New function. (update_solib_list, reload_shared_libraries_1): Check if objfile is used by another so_list object before freeing it.