summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-04-17 23:43:48 +0200
committerLennart Poettering <lennart@poettering.net>2012-04-17 23:43:48 +0200
commit747697607f9716e6200912e7063e132b416b9193 (patch)
treeacff1fb05249eb43b38b30bb2c2a91ac9ab327e4
parent9242a6bf0bb5517936883dbd8ab064e55c532998 (diff)
mkminidump: fix invalid fclose
-rw-r--r--mkminidump.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/mkminidump.c b/mkminidump.c
index 827b92f..41fde31 100644
--- a/mkminidump.c
+++ b/mkminidump.c
@@ -120,7 +120,7 @@ static int parse_argv(int argc, char *argv[]) {
}
static int output_and_free(const char *path, void **buffer, size_t *buffer_size) {
- FILE *f, *toclose;
+ FILE *f, *toclose = NULL;
int r = 0;
assert(buffer);
@@ -128,10 +128,9 @@ static int output_and_free(const char *path, void **buffer, size_t *buffer_size)
assert(buffer_size);
assert(*buffer_size > 0);
- if (!path || strcmp(path, "-") == 0) {
+ if (!path || strcmp(path, "-") == 0)
f = stdout;
- toclose = NULL;
- } else {
+ else {
f = fopen(path, "we");
if (!f) {
r = -errno;