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
3a547417
Commit
3a547417
authored
Jun 25, 2018
by
Nelson Elhage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git_pkt_free: Allow freeing NULL
parent
d58afb17
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
src/transports/smart_pkt.c
+4
-1
src/transports/smart_protocol.c
+4
-9
No files found.
src/transports/smart_pkt.c
View file @
3a547417
...
@@ -370,7 +370,7 @@ static int32_t parse_len(const char *line)
...
@@ -370,7 +370,7 @@ static int32_t parse_len(const char *line)
num
[
k
]
=
'.'
;
num
[
k
]
=
'.'
;
}
}
}
}
giterr_set
(
GITERR_NET
,
"invalid hex digit in length: '%s'"
,
num
);
giterr_set
(
GITERR_NET
,
"invalid hex digit in length: '%s'"
,
num
);
return
-
1
;
return
-
1
;
}
}
...
@@ -483,6 +483,9 @@ int git_pkt_parse_line(
...
@@ -483,6 +483,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 @
3a547417
...
@@ -321,9 +321,7 @@ static int wait_while_ack(gitno_buffer *buf)
...
@@ -321,9 +321,7 @@ static int wait_while_ack(gitno_buffer *buf)
git_pkt_ack
*
ack
=
NULL
;
git_pkt_ack
*
ack
=
NULL
;
while
(
1
)
{
while
(
1
)
{
if
(
pkt
)
{
git_pkt_free
(
pkt
);
git_pkt_free
(
pkt
);
}
if
((
error
=
recv_pkt
(
&
pkt
,
NULL
,
buf
))
<
0
)
if
((
error
=
recv_pkt
(
&
pkt
,
NULL
,
buf
))
<
0
)
return
error
;
return
error
;
...
@@ -342,9 +340,7 @@ static int wait_while_ack(gitno_buffer *buf)
...
@@ -342,9 +340,7 @@ static int wait_while_ack(gitno_buffer *buf)
}
}
}
}
if
(
pkt
)
{
git_pkt_free
(
pkt
);
git_pkt_free
(
pkt
);
}
return
0
;
return
0
;
}
}
...
@@ -622,9 +618,8 @@ int git_smart__download_pack(
...
@@ -622,9 +618,8 @@ int git_smart__download_pack(
}
}
}
}
if
(
pkt
)
{
git_pkt_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