summaryrefslogtreecommitdiff
path: root/src/core/hostname-setup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-09-13 22:30:26 +0200
committerLennart Poettering <lennart@poettering.net>2012-09-13 22:30:26 +0200
commit2fbe635a83a79f8889afec421ae3990ea106fb91 (patch)
tree99789cfa152da47458500fd09e978a7f9099e46d /src/core/hostname-setup.c
parenta1d41e17a5c3861becd66f1c9dba7eb39ae4c478 (diff)
macro: introduce _cleanup_free_ macro for automatic freeing of scoped vars and make use of it
Diffstat (limited to 'src/core/hostname-setup.c')
-rw-r--r--src/core/hostname-setup.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c
index 25ea09c73..120024065 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)