aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-10-30 20:33:51 +0000
committerTom Tromey <tromey@redhat.com>2008-10-30 20:33:51 +0000
commita05016c09e47a026bdbf05d02101c4eb40ac52f5 (patch)
treedb70ad45d3953f1060a808ad8234a67e9db5d6de /gdb
parent9fe4a2165de29f0802f0f9eb4801875e0f15c40a (diff)
downloadgdb-a05016c09e47a026bdbf05d02101c4eb40ac52f5.zip
gdb-a05016c09e47a026bdbf05d02101c4eb40ac52f5.tar.gz
gdb-a05016c09e47a026bdbf05d02101c4eb40ac52f5.tar.bz2
* utils.c (make_cleanup_close): Use make_cleanup_dtor.
(do_close_cleanup): Don't free 'fd'.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/utils.c3
2 files changed, 6 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c0fd6ea..885f276 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-30 Tom Tromey <tromey@redhat.com>
+
+ * utils.c (make_cleanup_close): Use make_cleanup_dtor.
+ (do_close_cleanup): Don't free 'fd'.
+
2008-10-28 Tom Tromey <tromey@redhat.com>
* source.c (symtab_to_fullname): Test 'r >= 0'.
diff --git a/gdb/utils.c b/gdb/utils.c
index f9a5f19..26d7933 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -244,7 +244,6 @@ do_close_cleanup (void *arg)
{
int *fd = arg;
close (*fd);
- xfree (fd);
}
struct cleanup *
@@ -252,7 +251,7 @@ make_cleanup_close (int fd)
{
int *saved_fd = xmalloc (sizeof (fd));
*saved_fd = fd;
- return make_cleanup (do_close_cleanup, saved_fd);
+ return make_cleanup_dtor (do_close_cleanup, saved_fd, xfree);
}
/* Helper function which does the work for make_cleanup_fclose. */