File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -4206,12 +4206,12 @@ disassemble_data (bfd *abfd)
42064206 abfd -> arch_info = inf ;
42074207 }
42084208
4209+ const struct bfd_target * old_xvec = NULL ;
42094210 if (endian != BFD_ENDIAN_UNKNOWN )
42104211 {
4211- struct bfd_target * xvec ;
4212-
4213- xvec = (struct bfd_target * ) xmalloc (sizeof (struct bfd_target ));
4214- memcpy (xvec , abfd -> xvec , sizeof (struct bfd_target ));
4212+ struct bfd_target * xvec = xmalloc (sizeof (* xvec ));
4213+ old_xvec = abfd -> xvec ;
4214+ memcpy (xvec , old_xvec , sizeof (* xvec ));
42154215 xvec -> byteorder = endian ;
42164216 abfd -> xvec = xvec ;
42174217 }
@@ -4225,8 +4225,7 @@ disassemble_data (bfd *abfd)
42254225 non_fatal (_ ("can't disassemble for architecture %s\n" ),
42264226 bfd_printable_arch_mach (bfd_get_arch (abfd ), 0 ));
42274227 exit_status = 1 ;
4228- free (sorted_syms );
4229- return ;
4228+ goto out ;
42304229 }
42314230
42324231 disasm_info .flavour = bfd_get_flavour (abfd );
@@ -4280,8 +4279,15 @@ disassemble_data (bfd *abfd)
42804279
42814280 free (disasm_info .dynrelbuf );
42824281 disasm_info .dynrelbuf = NULL ;
4283- free (sorted_syms );
42844282 disassemble_free_target (& disasm_info );
4283+ out :
4284+ free (sorted_syms );
4285+ sorted_syms = NULL ;
4286+ if (old_xvec )
4287+ {
4288+ free ((void * ) abfd -> xvec );
4289+ abfd -> xvec = old_xvec ;
4290+ }
42854291}
42864292
42874293static bool
You can’t perform that action at this time.
0 commit comments