diff options
author | Jim Blandy <jimb@codesourcery.com> | 2000-03-16 23:12:42 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2000-03-16 23:12:42 +0000 |
commit | 15588ebb212b051918e6cc4fb42ac194369e3d22 (patch) | |
tree | 0b2be0a6d0939d50e15a0659d12236e983ac5847 /gdb/solib.c | |
parent | 97780f5f6a20b8c0b3e48355b99d3ceaab822191 (diff) | |
download | gdb-15588ebb212b051918e6cc4fb42ac194369e3d22.zip gdb-15588ebb212b051918e6cc4fb42ac194369e3d22.tar.gz gdb-15588ebb212b051918e6cc4fb42ac194369e3d22.tar.bz2 |
* solib.c (current_sos): Be more careful about freeing the new
so_list node if an error occurs.
Diffstat (limited to 'gdb/solib.c')
-rw-r--r-- | gdb/solib.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/solib.c b/gdb/solib.c index c9f1e14..f1537f3 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1091,6 +1091,7 @@ current_sos () { struct so_list *new = (struct so_list *) xmalloc (sizeof (struct so_list)); + struct cleanup *old_chain = make_cleanup (free, new); memset (new, 0, sizeof (*new)); new->lmaddr = lm; @@ -1104,9 +1105,7 @@ current_sos () does have a name, so we can no longer use a missing name to decide when to ignore it. */ if (IGNORE_FIRST_LINK_MAP_ENTRY (new)) - { - free_so (new); - } + free_so (new); else { int errcode; @@ -1140,6 +1139,8 @@ current_sos () link_ptr = &new->next; } } + + discard_cleanups (old_chain); } return head; |