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
12232a5e
Unverified
Commit
12232a5e
authored
Jun 27, 2018
by
Edward Thomson
Committed by
GitHub
Jun 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4698 from nelhage/fix-leaks
Fix assorted leaks found via fuzzing
parents
5dd34702
3a547417
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
13 deletions
+24
-13
src/transports/smart.c
+6
-2
src/transports/smart_pkt.c
+3
-0
src/transports/smart_protocol.c
+15
-11
No files found.
src/transports/smart.c
View file @
12232a5e
...
@@ -167,9 +167,11 @@ int git_smart__update_heads(transport_smart *t, git_vector *symrefs)
...
@@ -167,9 +167,11 @@ int git_smart__update_heads(transport_smart *t, git_vector *symrefs)
git_vector_foreach
(
symrefs
,
j
,
spec
)
{
git_vector_foreach
(
symrefs
,
j
,
spec
)
{
git_buf_clear
(
&
buf
);
git_buf_clear
(
&
buf
);
if
(
git_refspec_src_matches
(
spec
,
ref
->
head
.
name
)
&&
if
(
git_refspec_src_matches
(
spec
,
ref
->
head
.
name
)
&&
!
(
error
=
git_refspec_transform
(
&
buf
,
spec
,
ref
->
head
.
name
)))
!
(
error
=
git_refspec_transform
(
&
buf
,
spec
,
ref
->
head
.
name
)))
{
git__free
(
ref
->
head
.
symref_target
);
ref
->
head
.
symref_target
=
git_buf_detach
(
&
buf
);
ref
->
head
.
symref_target
=
git_buf_detach
(
&
buf
);
}
}
}
git_buf_dispose
(
&
buf
);
git_buf_dispose
(
&
buf
);
...
@@ -277,8 +279,10 @@ static int git_smart__connect(
...
@@ -277,8 +279,10 @@ static int git_smart__connect(
return
error
;
return
error
;
/* Detect capabilities */
/* Detect capabilities */
if
(
git_smart__detect_caps
(
first
,
&
t
->
caps
,
&
symrefs
)
<
0
)
if
(
git_smart__detect_caps
(
first
,
&
t
->
caps
,
&
symrefs
)
<
0
)
{
free_symrefs
(
&
symrefs
);
return
-
1
;
return
-
1
;
}
/* If the only ref in the list is capabilities^{} with OID_ZERO, remove it */
/* If the only ref in the list is capabilities^{} with OID_ZERO, remove it */
if
(
1
==
t
->
refs
.
length
&&
!
strcmp
(
first
->
head
.
name
,
"capabilities^{}"
)
&&
if
(
1
==
t
->
refs
.
length
&&
!
strcmp
(
first
->
head
.
name
,
"capabilities^{}"
)
&&
...
...
src/transports/smart_pkt.c
View file @
12232a5e
...
@@ -488,6 +488,9 @@ int git_pkt_parse_line(
...
@@ -488,6 +488,9 @@ int git_pkt_parse_line(
void
git_pkt_free
(
git_pkt
*
pkt
)
void
git_pkt_free
(
git_pkt
*
pkt
)
{
{
if
(
pkt
==
NULL
)
{
return
;
}
if
(
pkt
->
type
==
GIT_PKT_REF
)
{
if
(
pkt
->
type
==
GIT_PKT_REF
)
{
git_pkt_ref
*
p
=
(
git_pkt_ref
*
)
pkt
;
git_pkt_ref
*
p
=
(
git_pkt_ref
*
)
pkt
;
git__free
(
p
->
head
.
name
);
git__free
(
p
->
head
.
name
);
...
...
src/transports/smart_protocol.c
View file @
12232a5e
...
@@ -323,27 +323,30 @@ on_error:
...
@@ -323,27 +323,30 @@ on_error:
static
int
wait_while_ack
(
gitno_buffer
*
buf
)
static
int
wait_while_ack
(
gitno_buffer
*
buf
)
{
{
int
error
;
int
error
;
git_pkt_ack
*
pkt
=
NULL
;
git_pkt
*
pkt
=
NULL
;
git_pkt_ack
*
ack
=
NULL
;
while
(
1
)
{
while
(
1
)
{
git__free
(
pkt
);
git_
pkt
_free
(
pkt
);
if
((
error
=
recv_pkt
(
(
git_pkt
**
)
&
pkt
,
NULL
,
buf
))
<
0
)
if
((
error
=
recv_pkt
(
&
pkt
,
NULL
,
buf
))
<
0
)
return
error
;
return
error
;
if
(
pkt
->
type
==
GIT_PKT_NAK
)
if
(
pkt
->
type
==
GIT_PKT_NAK
)
break
;
break
;
if
(
pkt
->
type
!=
GIT_PKT_ACK
)
continue
;
if
(
pkt
->
type
==
GIT_PKT_ACK
&&
ack
=
(
git_pkt_ack
*
)
pkt
;
(
pkt
->
status
!=
GIT_ACK_CONTINUE
&&
pkt
->
status
!=
GIT_ACK_COMMON
&&
if
(
ack
->
status
!=
GIT_ACK_CONTINUE
&&
pkt
->
status
!=
GIT_ACK_READY
))
{
ack
->
status
!=
GIT_ACK_COMMON
&&
git__free
(
pkt
);
ack
->
status
!=
GIT_ACK_READY
)
{
return
0
;
break
;
}
}
}
}
git__free
(
pkt
);
git_
pkt
_free
(
pkt
);
return
0
;
return
0
;
}
}
...
@@ -621,7 +624,8 @@ int git_smart__download_pack(
...
@@ -621,7 +624,8 @@ int git_smart__download_pack(
}
}
}
}
git__free
(
pkt
);
git_pkt_free
(
pkt
);
if
(
error
<
0
)
if
(
error
<
0
)
goto
done
;
goto
done
;
...
...
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