From 2fbe635a83a79f8889afec421ae3990ea106fb91 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 13 Sep 2012 22:30:26 +0200 Subject: macro: introduce _cleanup_free_ macro for automatic freeing of scoped vars and make use of it --- src/core/hostname-setup.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core/hostname-setup.c') diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c index 25ea09c733..120024065a 100644 --- a/src/core/hostname-setup.c +++ b/src/core/hostname-setup.c @@ -67,7 +67,7 @@ static int read_distro_hostname(char **hn) { #if defined(TARGET_FEDORA) || defined(TARGET_ARCH) || defined(TARGET_GENTOO) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA) int r; - FILE *f; + _cleanup_fclose_ FILE *f = NULL; assert(hn); @@ -114,7 +114,6 @@ static int read_distro_hostname(char **hn) { r = -ENOENT; finish: - fclose(f); return r; #elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE) -- cgit v1.2.3-54-g00ecf