* utils.c (make_cleanup_close): Use make_cleanup_dtor.
(do_close_cleanup): Don't free 'fd'.
This commit is contained in:
parent
9fe4a2165d
commit
a05016c09e
2 changed files with 6 additions and 2 deletions
|
@ -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>
|
2008-10-28 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* source.c (symtab_to_fullname): Test 'r >= 0'.
|
* source.c (symtab_to_fullname): Test 'r >= 0'.
|
||||||
|
|
|
@ -244,7 +244,6 @@ do_close_cleanup (void *arg)
|
||||||
{
|
{
|
||||||
int *fd = arg;
|
int *fd = arg;
|
||||||
close (*fd);
|
close (*fd);
|
||||||
xfree (fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cleanup *
|
struct cleanup *
|
||||||
|
@ -252,7 +251,7 @@ make_cleanup_close (int fd)
|
||||||
{
|
{
|
||||||
int *saved_fd = xmalloc (sizeof (fd));
|
int *saved_fd = xmalloc (sizeof (fd));
|
||||||
*saved_fd = 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. */
|
/* Helper function which does the work for make_cleanup_fclose. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue