if (convert_debugging && dhandle != NULL)
{
- if (! write_debugging_info (obfd, dhandle, &symcount, &osympp))
+ bfd_boolean res;
+
+ res = write_debugging_info (obfd, dhandle, &symcount, &osympp);
+
+ free (dhandle);
+ dhandle = NULL; /* Paranoia... */
+
+ if (! res)
{
status = 1;
return FALSE;