summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryuangli <yuangli@mathworks.com>2022-08-01 21:42:11 +0100
committeryuangli <yuangli@mathworks.com>2022-08-01 21:42:11 +0100
commite7294e870398d72b79a436b628170ffcaaa1713c (patch)
treede66cbffba546c3cd1e60da7c84bbbf0a159b1eb
parent179aac788d45d3683a93ad478bfb7371c549ca98 (diff)
downloadlibgit2-e7294e870398d72b79a436b628170ffcaaa1713c.tar.gz
fix memory leaks about packets
-rw-r--r--src/libgit2/transports/smart_pkt.c2
-rw-r--r--src/libgit2/transports/smart_protocol.c4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/libgit2/transports/smart_pkt.c b/src/libgit2/transports/smart_pkt.c
index 951356c29..5808b8816 100644
--- a/src/libgit2/transports/smart_pkt.c
+++ b/src/libgit2/transports/smart_pkt.c
@@ -694,6 +694,8 @@ int git_pkt_buffer_wants(
git_str_printf(&deepen_buf, "deepen %d\n", wants->depth);
git_str_printf(buf,"%04x%s", (unsigned int)git_str_len(&deepen_buf) + 4, git_str_cstr(&deepen_buf));
+ git_str_dispose(&deepen_buf);
+
if (git_str_oom(buf))
return -1;
}
diff --git a/src/libgit2/transports/smart_protocol.c b/src/libgit2/transports/smart_protocol.c
index f2a6ac508..a44d0c853 100644
--- a/src/libgit2/transports/smart_protocol.c
+++ b/src/libgit2/transports/smart_protocol.c
@@ -385,8 +385,12 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
git_error_set(GIT_ERROR_NET, "Unexpected pkt type");
goto on_error;
}
+
+ git_pkt_free((git_pkt *) pkt);
}
+ git_pkt_free((git_pkt *) pkt);
+
if (error < 0) {
goto on_error;
}