Merge branch 'lb/status-stash-count'
[gitweb.git] / rerere.c
index 1351b0c3fbd47e9f6e913e586081a7317670f807..70634d456cc0b70cdbac1579b82016761252c7d9 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "config.h"
 #include "lockfile.h"
 #include "string-list.h"
 #include "rerere.h"
@@ -39,9 +40,8 @@ static void free_rerere_dirs(void)
                free(rerere_dir[i]->status);
                free(rerere_dir[i]);
        }
-       free(rerere_dir);
+       FREE_AND_NULL(rerere_dir);
        rerere_dir_nr = rerere_dir_alloc = 0;
-       rerere_dir = NULL;
 }
 
 static void free_rerere_id(struct string_list_item *item)
@@ -489,8 +489,9 @@ static int handle_file(const char *path, unsigned char *sha1, const char *output
        if (output) {
                io.io.output = fopen(output, "w");
                if (!io.io.output) {
+                       error_errno("Could not write %s", output);
                        fclose(io.input);
-                       return error_errno("Could not write %s", output);
+                       return -1;
                }
        }