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
d29c5412
Commit
d29c5412
authored
Sep 10, 2015
by
Matt Burke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid segfault when opts == NULL
parent
3245896b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/remote.c
+8
-3
No files found.
src/remote.c
View file @
d29c5412
...
@@ -2392,14 +2392,17 @@ int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const gi
...
@@ -2392,14 +2392,17 @@ int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const gi
git_push
*
push
;
git_push
*
push
;
git_refspec
*
spec
;
git_refspec
*
spec
;
const
git_remote_callbacks
*
cbs
=
NULL
;
const
git_remote_callbacks
*
cbs
=
NULL
;
const
git_strarray
*
custom_headers
=
NULL
;
assert
(
remote
);
assert
(
remote
);
if
(
opts
)
if
(
opts
)
{
cbs
=
&
opts
->
callbacks
;
cbs
=
&
opts
->
callbacks
;
custom_headers
=
&
opts
->
custom_headers
;
}
if
(
!
git_remote_connected
(
remote
)
&&
if
(
!
git_remote_connected
(
remote
)
&&
(
error
=
git_remote_connect
(
remote
,
GIT_DIRECTION_PUSH
,
cbs
,
&
opts
->
custom_headers
))
<
0
)
(
error
=
git_remote_connect
(
remote
,
GIT_DIRECTION_PUSH
,
cbs
,
custom_headers
))
<
0
)
goto
cleanup
;
goto
cleanup
;
free_refspecs
(
&
remote
->
active_refspecs
);
free_refspecs
(
&
remote
->
active_refspecs
);
...
@@ -2448,15 +2451,17 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
...
@@ -2448,15 +2451,17 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
{
{
int
error
;
int
error
;
const
git_remote_callbacks
*
cbs
=
NULL
;
const
git_remote_callbacks
*
cbs
=
NULL
;
const
git_strarray
*
custom_headers
=
NULL
;
if
(
opts
)
{
if
(
opts
)
{
GITERR_CHECK_VERSION
(
&
opts
->
callbacks
,
GIT_REMOTE_CALLBACKS_VERSION
,
"git_remote_callbacks"
);
GITERR_CHECK_VERSION
(
&
opts
->
callbacks
,
GIT_REMOTE_CALLBACKS_VERSION
,
"git_remote_callbacks"
);
cbs
=
&
opts
->
callbacks
;
cbs
=
&
opts
->
callbacks
;
custom_headers
=
&
opts
->
custom_headers
;
}
}
assert
(
remote
&&
refspecs
);
assert
(
remote
&&
refspecs
);
if
((
error
=
git_remote_connect
(
remote
,
GIT_DIRECTION_PUSH
,
cbs
,
&
opts
->
custom_headers
))
<
0
)
if
((
error
=
git_remote_connect
(
remote
,
GIT_DIRECTION_PUSH
,
cbs
,
custom_headers
))
<
0
)
return
error
;
return
error
;
if
((
error
=
git_remote_upload
(
remote
,
refspecs
,
opts
))
<
0
)
if
((
error
=
git_remote_upload
(
remote
,
refspecs
,
opts
))
<
0
)
...
...
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