Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b0f7512

Browse files
committed
transports: smart_pkt: fix memory leaks
1 parent 704554c commit b0f7512

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/transports/smart_pkt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
271271
line += 3; /* skip "ok " */
272272
if (!(ptr = strchr(line, '\n'))) {
273273
giterr_set(GITERR_NET, "Invalid packet line");
274+
git__free(pkt);
274275
return -1;
275276
}
276277
len = ptr - line;
@@ -314,6 +315,8 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
314315
line = ptr + 1;
315316
if (!(ptr = strchr(line, '\n'))) {
316317
giterr_set(GITERR_NET, "Invalid packet line");
318+
git__free(pkt->ref);
319+
git__free(pkt);
317320
return -1;
318321
}
319322
len = ptr - line;

0 commit comments

Comments
 (0)