Skip to content

Commit 2cf9b84

Browse files
committed
smart: free the pkt when we fail to store it
1 parent 32586d5 commit 2cf9b84

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/transports/smart_protocol.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,15 @@ static int store_common(transport_smart *t)
256256
if ((error = recv_pkt(&pkt, NULL, buf)) < 0)
257257
return error;
258258

259-
if (pkt->type == GIT_PKT_ACK) {
260-
if (git_vector_insert(&t->common, pkt) < 0)
261-
return -1;
262-
} else {
259+
if (pkt->type != GIT_PKT_ACK) {
263260
git__free(pkt);
264261
return 0;
265262
}
266263

264+
if (git_vector_insert(&t->common, pkt) < 0) {
265+
git__free(pkt);
266+
return -1;
267+
}
267268
} while (1);
268269

269270
return 0;

0 commit comments

Comments
 (0)