Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
8c252874
Commit
8c252874
authored
Oct 06, 2011
by
Carlos Martín Nieto
Committed by
Vicent Marti
Oct 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: plug a few memory leaks
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
parent
546a3c8f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
src/transport-http.c
+14
-2
src/transport_git.c
+3
-0
No files found.
src/transport-http.c
View file @
8c252874
...
@@ -389,15 +389,20 @@ static int on_body_parse_response(http_parser *parser, const char *str, size_t l
...
@@ -389,15 +389,20 @@ static int on_body_parse_response(http_parser *parser, const char *str, size_t l
git_buf_consume
(
buf
,
line_end
);
git_buf_consume
(
buf
,
line_end
);
if
(
pkt
->
type
==
GIT_PKT_PACK
)
{
if
(
pkt
->
type
==
GIT_PKT_PACK
)
{
free
(
pkt
);
t
->
pack_ready
=
1
;
t
->
pack_ready
=
1
;
return
0
;
return
0
;
}
}
if
(
pkt
->
type
==
GIT_PKT_NAK
)
if
(
pkt
->
type
==
GIT_PKT_NAK
)
{
free
(
pkt
);
return
0
;
return
0
;
}
if
(
pkt
->
type
!=
GIT_PKT_ACK
)
if
(
pkt
->
type
!=
GIT_PKT_ACK
)
{
free
(
pkt
);
continue
;
continue
;
}
error
=
git_vector_insert
(
common
,
pkt
);
error
=
git_vector_insert
(
common
,
pkt
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
...
@@ -596,6 +601,8 @@ static int http_negotiate_fetch(git_transport *transport, git_repository *repo,
...
@@ -596,6 +601,8 @@ static int http_negotiate_fetch(git_transport *transport, git_repository *repo,
}
while
(
1
);
}
while
(
1
);
cleanup:
cleanup:
git_buf_free
(
&
request
);
git_buf_free
(
&
data
);
git_revwalk_free
(
walk
);
git_revwalk_free
(
walk
);
return
error
;
return
error
;
}
}
...
@@ -722,6 +729,7 @@ static void http_free(git_transport *transport)
...
@@ -722,6 +729,7 @@ static void http_free(git_transport *transport)
{
{
transport_http
*
t
=
(
transport_http
*
)
transport
;
transport_http
*
t
=
(
transport_http
*
)
transport
;
git_vector
*
refs
=
&
t
->
refs
;
git_vector
*
refs
=
&
t
->
refs
;
git_vector
*
common
=
&
t
->
common
;
unsigned
int
i
;
unsigned
int
i
;
git_pkt
*
p
;
git_pkt
*
p
;
...
@@ -737,6 +745,10 @@ static void http_free(git_transport *transport)
...
@@ -737,6 +745,10 @@ static void http_free(git_transport *transport)
git_pkt_free
(
p
);
git_pkt_free
(
p
);
}
}
git_vector_free
(
refs
);
git_vector_free
(
refs
);
git_vector_foreach
(
common
,
i
,
p
)
{
git_pkt_free
(
p
);
}
git_vector_free
(
common
);
git_buf_free
(
&
t
->
buf
);
git_buf_free
(
&
t
->
buf
);
free
(
t
->
heads
);
free
(
t
->
heads
);
free
(
t
->
content_type
);
free
(
t
->
content_type
);
...
...
src/transport_git.c
View file @
8c252874
...
@@ -357,9 +357,11 @@ static int git_negotiate_fetch(git_transport *transport, git_repository *repo, g
...
@@ -357,9 +357,11 @@ static int git_negotiate_fetch(git_transport *transport, git_repository *repo, g
gitno_consume
(
buf
,
line_end
);
gitno_consume
(
buf
,
line_end
);
if
(
pkt
->
type
==
GIT_PKT_ACK
)
{
if
(
pkt
->
type
==
GIT_PKT_ACK
)
{
free
(
pkt
);
error
=
GIT_SUCCESS
;
error
=
GIT_SUCCESS
;
goto
done
;
goto
done
;
}
else
if
(
pkt
->
type
==
GIT_PKT_NAK
)
{
}
else
if
(
pkt
->
type
==
GIT_PKT_NAK
)
{
free
(
pkt
);
break
;
break
;
}
else
{
}
else
{
error
=
git__throw
(
GIT_ERROR
,
"Got unexpected pkt type"
);
error
=
git__throw
(
GIT_ERROR
,
"Got unexpected pkt type"
);
...
@@ -422,6 +424,7 @@ static int git_download_pack(char **out, git_transport *transport, git_repositor
...
@@ -422,6 +424,7 @@ static int git_download_pack(char **out, git_transport *transport, git_repositor
return
error
;
return
error
;
if
(
pkt
->
type
==
GIT_PKT_PACK
)
{
if
(
pkt
->
type
==
GIT_PKT_PACK
)
{
free
(
pkt
);
return
git_fetch__download_pack
(
out
,
buf
->
data
,
buf
->
offset
,
t
->
socket
,
repo
);
return
git_fetch__download_pack
(
out
,
buf
->
data
,
buf
->
offset
,
t
->
socket
,
repo
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment