Commit b0f7512f by Patrick Steinhardt

transports: smart_pkt: fix memory leaks

parent 704554cd
...@@ -271,6 +271,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len) ...@@ -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) ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment