diff options
author | Tom Tromey <tromey@adacore.com> | 2019-02-21 10:40:49 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2019-02-25 06:55:02 -0700 |
commit | cd5a152cebb201e98f3dbeca510aa39e838a1f62 (patch) | |
tree | 89c5978b8bd4d73a09ba27e2fbc5c69dd7a58ff1 /gdb/solib-darwin.c | |
parent | 39f0547e554df96608dd041d2a7b3c72882fd515 (diff) | |
download | gdb-cd5a152cebb201e98f3dbeca510aa39e838a1f62.zip gdb-cd5a152cebb201e98f3dbeca510aa39e838a1f62.tar.gz gdb-cd5a152cebb201e98f3dbeca510aa39e838a1f62.tar.bz2 |
Fix BFD leak in solib-darwin.c
commit 192b62ce0b4bb5c61188f570e127a26d2c32f716 ("Use class to manage
BFD reference counts") changed darwin_get_dyld_bfd to use:
+ dyld_bfd.release ();
rather than
- do_cleanups (cleanup);
However, using release here leaks the BFD. Instead, simply assigning
"sub" to "dyld_bfd" achieves what was meant.
gdb/ChangeLog
2019-02-25 Tom Tromey <tromey@adacore.com>
* solib-darwin.c (darwin_get_dyld_bfd): Don't release dyld_bfd.
Diffstat (limited to 'gdb/solib-darwin.c')
-rw-r--r-- | gdb/solib-darwin.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index d306060..b976b79 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -452,10 +452,7 @@ darwin_get_dyld_bfd () gdb_bfd_ref_ptr sub (gdb_bfd_mach_o_fat_extract (dyld_bfd.get (), bfd_object, gdbarch_bfd_arch_info (target_gdbarch ()))); - if (sub != NULL) - dyld_bfd = sub; - else - dyld_bfd.release (); + dyld_bfd = sub; } return dyld_bfd; } |