mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-01 08:24:41 +00:00
transports: smart_pkt: fix memory leaks
This commit is contained in:
parent
704554cdf0
commit
b0f7512f40
@ -271,6 +271,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
|
|||||||
line += 3; /* skip "ok " */
|
line += 3; /* skip "ok " */
|
||||||
if (!(ptr = strchr(line, '\n'))) {
|
if (!(ptr = strchr(line, '\n'))) {
|
||||||
giterr_set(GITERR_NET, "Invalid packet line");
|
giterr_set(GITERR_NET, "Invalid packet line");
|
||||||
|
git__free(pkt);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len = ptr - line;
|
len = ptr - line;
|
||||||
@ -314,6 +315,8 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
|
|||||||
line = ptr + 1;
|
line = ptr + 1;
|
||||||
if (!(ptr = strchr(line, '\n'))) {
|
if (!(ptr = strchr(line, '\n'))) {
|
||||||
giterr_set(GITERR_NET, "Invalid packet line");
|
giterr_set(GITERR_NET, "Invalid packet line");
|
||||||
|
git__free(pkt->ref);
|
||||||
|
git__free(pkt);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len = ptr - line;
|
len = ptr - line;
|
||||||
|
Loading…
Reference in New Issue
Block a user