diff options
author | Tom Tromey <tromey@redhat.com> | 2013-05-30 17:33:41 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-05-30 17:33:41 +0000 |
commit | 795d915c9b6efeea3d6d5574cecbaec3e16c763b (patch) | |
tree | 799df10c510ccdd8cf164ff09f1019f95d5d384a | |
parent | 1fc3cf4a5ac1e3dddf9aee7832fcd2b958ea399f (diff) | |
download | gdb-795d915c9b6efeea3d6d5574cecbaec3e16c763b.zip gdb-795d915c9b6efeea3d6d5574cecbaec3e16c763b.tar.gz gdb-795d915c9b6efeea3d6d5574cecbaec3e16c763b.tar.bz2 |
fix source.c
find_and_open_source can leak a cleanup.
* source.c (find_and_open_source): Call do_cleanups.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/source.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c2eb3bb..080275e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2013-05-30 Tom Tromey <tromey@redhat.com> + * source.c (find_and_open_source): Call do_cleanups. + +2013-05-30 Tom Tromey <tromey@redhat.com> + * linux-thread-db.c (thread_db_load_search): Unconditionally call do_cleanups. diff --git a/gdb/source.c b/gdb/source.c index 161a6c4..71b6d53 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -985,6 +985,7 @@ find_and_open_source (const char *filename, char *path = source_path; const char *p; int result; + struct cleanup *cleanup; /* Quick way out if we already know its full name. */ @@ -1016,6 +1017,8 @@ find_and_open_source (const char *filename, *fullname = NULL; } + cleanup = make_cleanup (null_cleanup, NULL); + if (dirname != NULL) { /* If necessary, rewrite the compilation directory name according @@ -1072,6 +1075,7 @@ find_and_open_source (const char *filename, result = openp (path, OPF_SEARCH_IN_PATH, p, OPEN_MODE, fullname); } + do_cleanups (cleanup); return result; } |