X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fsolib-target.c;h=23cb2e7f14e313da9c3f6ea9c7e36fd1e384f9aa;hb=45a466b578083a05f1138eff9232254b1a30f683;hp=888aa349da25f4019a2431541b224726f51f8c63;hpb=d6c10e950e91d34b7193c43395c695b0fd51400f;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 888aa349da..23cb2e7f14 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -1,6 +1,6 @@ /* Definitions for targets which report shared library events. - Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 2007-2013 Free Software Foundation, Inc. This file is part of GDB. @@ -28,8 +28,6 @@ #include "gdb_string.h" -DEF_VEC_I(CORE_ADDR); - /* Private data for each loaded library. */ struct lm_info { @@ -248,7 +246,8 @@ static struct so_list * solib_target_current_sos (void) { struct so_list *new_solib, *start = NULL, *last = NULL; - const char *library_document; + char *library_document; + struct cleanup *old_chain; VEC(lm_info_p) *library_list; struct lm_info *info; int ix; @@ -260,8 +259,15 @@ solib_target_current_sos (void) if (library_document == NULL) return NULL; + /* solib_target_parse_libraries may throw, so we use a cleanup. */ + old_chain = make_cleanup (xfree, library_document); + /* Parse the list. */ library_list = solib_target_parse_libraries (library_document); + + /* library_document string is not needed behind this point. */ + do_cleanups (old_chain); + if (library_list == NULL) return NULL;