This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
solib.c: minor cleanup
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: solib.c: minor cleanup
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- Date: Thu, 16 Mar 2000 19:01:12 -0500 (EST)
2000-03-16 Jim Blandy <jimb@redhat.com>
* solib.c (current_sos): Be more careful about freeing the new
so_list node if an error occurs.
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -c -r1.3 -r1.4
*** solib.c 2000/03/15 16:55:07 1.3
--- solib.c 2000/03/16 23:12:42 1.4
***************
*** 1091,1096 ****
--- 1091,1097 ----
{
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,1112 ****
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);
! }
else
{
int errcode;
--- 1105,1111 ----
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);
else
{
int errcode;
***************
*** 1140,1145 ****
--- 1139,1146 ----
link_ptr = &new->next;
}
}
+
+ discard_cleanups (old_chain);
}
return head;