http*: cleanup slot->local after fclose
[gitweb.git] / http-push.c
index 5138224cc372482fb60afd350fa40e37d019f367..673a61110e9653a312e3d11bcdb049d181a3898f 100644 (file)
@@ -724,9 +724,11 @@ static void finish_request(struct transfer_request *request)
        struct stat st;
        struct packed_git *target;
        struct packed_git **lst;
+       struct active_request_slot *slot;
 
        request->curl_result = request->slot->curl_result;
        request->http_code = request->slot->http_code;
+       slot = request->slot;
        request->slot = NULL;
 
        /* Keep locks active */
@@ -823,6 +825,7 @@ static void finish_request(struct transfer_request *request)
 
                        fclose(request->local_stream);
                        request->local_stream = NULL;
+                       slot->local = NULL;
                        if (!move_temp_to_file(request->tmpfile,
                                               request->filename)) {
                                target = (struct packed_git *)request->userData;
@@ -1024,17 +1027,20 @@ static int fetch_index(unsigned char *sha1)
                if (results.curl_result != CURLE_OK) {
                        free(url);
                        fclose(indexfile);
+                       slot->local = NULL;
                        return error("Unable to get pack index %s\n%s", url,
                                     curl_errorstr);
                }
        } else {
                free(url);
                fclose(indexfile);
+               slot->local = NULL;
                return error("Unable to start request");
        }
 
        free(url);
        fclose(indexfile);
+       slot->local = NULL;
 
        return move_temp_to_file(tmpfile, filename);
 }