X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Ffileio.c;h=0eca4416f81f89901a00a64559f714b07fe26886;hb=9f26c90cb50c45d4549c4dd569917b4ac143b94d;hp=4e6ff16045d68ff4e4b6c26d97c2ae50080eaf31;hpb=a5c32cff1f56afe6f0c6c70d91a88a7a8238b2d7;p=elogind.git diff --git a/src/shared/fileio.c b/src/shared/fileio.c index 4e6ff1604..0eca4416f 100644 --- a/src/shared/fileio.c +++ b/src/shared/fileio.c @@ -187,7 +187,8 @@ int parse_env_file( assert(fname); assert(separator); - if ((r = read_full_file(fname, &contents, NULL)) < 0) + r = read_full_file(fname, &contents, NULL); + if (r < 0) return r; p = contents; @@ -343,8 +344,9 @@ int load_env_file(const char *fname, char ***rl) { } int write_env_file(const char *fname, char **l) { - char **i, *p; - FILE *f; + char **i; + char _cleanup_free_ *p = NULL; + FILE _cleanup_fclose_ *f = NULL; int r; r = fopen_temporary(fname, &f, &p); @@ -376,8 +378,5 @@ int write_env_file(const char *fname, char **l) { if (r < 0) unlink(p); - fclose(f); - free(p); - return r; }