]> git.proxmox.com Git - libgit2.git/commitdiff
Fix a leak when canceling a network operation
authorBen Straub <bs@github.com>
Thu, 14 Feb 2013 16:12:05 +0000 (08:12 -0800)
committerBen Straub <bs@github.com>
Thu, 14 Feb 2013 16:12:55 +0000 (08:12 -0800)
src/transports/smart_protocol.c

index 596dba66fc78fbcf881260678a91cc55f61dc05e..75494b2c7c1c224ee1cdca8c84611d85452fa230 100644 (file)
@@ -493,10 +493,11 @@ int git_smart__download_pack(
                        git__free(pkt);
                } else if (pkt->type == GIT_PKT_DATA) {
                        git_pkt_data *p = (git_pkt_data *) pkt;
-                       if ((error = writepack->add(writepack, p->data, p->len, stats)) < 0)
-                               goto on_error;
+                       error = writepack->add(writepack, p->data, p->len, stats);
 
                        git__free(pkt);
+                       if (error < 0)
+                               goto on_error;
                } else if (pkt->type == GIT_PKT_FLUSH) {
                        /* A flush indicates the end of the packfile */
                        git__free(pkt);