From: Tom Tromey Date: Thu, 30 Oct 2008 20:33:51 +0000 (+0000) Subject: * utils.c (make_cleanup_close): Use make_cleanup_dtor. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a05016c09e47a026bdbf05d02101c4eb40ac52f5;p=binutils-gdb.git * utils.c (make_cleanup_close): Use make_cleanup_dtor. (do_close_cleanup): Don't free 'fd'. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c0fd6ea2356..885f2760536 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-10-30 Tom Tromey + + * utils.c (make_cleanup_close): Use make_cleanup_dtor. + (do_close_cleanup): Don't free 'fd'. + 2008-10-28 Tom Tromey * source.c (symtab_to_fullname): Test 'r >= 0'. diff --git a/gdb/utils.c b/gdb/utils.c index f9a5f19fded..26d79334696 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. */