summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2013-02-14 08:12:05 -0800
committerBen Straub <bs@github.com>2013-02-14 08:12:55 -0800
commita9e1339c06795c9b5f4eb4e5b2f56b8fadf98115 (patch)
tree24a934d58b1fde12de9f916b75b1e79c60105df6
parent2fe67aeb10ec7d5995464589687ff193959a71b4 (diff)
downloadlibgit2-a9e1339c06795c9b5f4eb4e5b2f56b8fadf98115.tar.gz
Fix a leak when canceling a network operation
-rw-r--r--src/transports/smart_protocol.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index 596dba66f..75494b2c7 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -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);