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
da6720fc
Commit
da6720fc
authored
Jun 10, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3201 from libgit2/cmn/coverity
A few more fixes from coverity
parents
2d73075a
0137aba5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
19 deletions
+21
-19
src/filter.c
+3
-2
src/merge.c
+2
-2
src/object.c
+5
-5
src/pack.c
+11
-10
No files found.
src/filter.c
View file @
da6720fc
...
...
@@ -887,7 +887,7 @@ int git_filter_list_stream_file(
git_vector
filter_streams
=
GIT_VECTOR_INIT
;
git_writestream
*
stream_start
;
ssize_t
readlen
;
int
fd
,
error
;
int
fd
=
-
1
,
error
;
if
((
error
=
stream_list_init
(
&
stream_start
,
&
filter_streams
,
filters
,
target
))
<
0
||
...
...
@@ -909,9 +909,10 @@ int git_filter_list_stream_file(
else
if
(
readlen
<
0
)
error
=
readlen
;
p_close
(
fd
);
done:
if
(
fd
>=
0
)
p_close
(
fd
);
stream_list_free
(
&
filter_streams
);
git_buf_free
(
&
abspath
);
return
error
;
...
...
src/merge.c
View file @
da6720fc
...
...
@@ -1143,9 +1143,9 @@ static void merge_diff_list_count_candidates(
if
(
GIT_MERGE_INDEX_ENTRY_EXISTS
(
entry
->
ancestor_entry
)
&&
(
!
GIT_MERGE_INDEX_ENTRY_EXISTS
(
entry
->
our_entry
)
||
!
GIT_MERGE_INDEX_ENTRY_EXISTS
(
entry
->
their_entry
)))
src_count
++
;
(
*
src_count
)
++
;
else
if
(
!
GIT_MERGE_INDEX_ENTRY_EXISTS
(
entry
->
ancestor_entry
))
tgt_count
++
;
(
*
tgt_count
)
++
;
}
}
...
...
src/object.c
View file @
da6720fc
...
...
@@ -129,10 +129,10 @@ int git_object_lookup_prefix(
if
(
error
<
0
)
return
error
;
if
(
len
>
GIT_OID_
HEX
SZ
)
len
=
GIT_OID_
HEX
SZ
;
if
(
len
>
GIT_OID_
RAW
SZ
)
len
=
GIT_OID_
RAW
SZ
;
if
(
len
==
GIT_OID_
HEX
SZ
)
{
if
(
len
==
GIT_OID_
RAW
SZ
)
{
git_cached_obj
*
cached
=
NULL
;
/* We want to match the full id : we can first look up in the cache,
...
...
@@ -172,9 +172,9 @@ int git_object_lookup_prefix(
memcpy
(
short_oid
.
id
,
id
->
id
,
(
len
+
1
)
/
2
);
if
(
len
%
2
)
short_oid
.
id
[
len
/
2
]
&=
0xF0
;
memset
(
short_oid
.
id
+
(
len
+
1
)
/
2
,
0
,
(
GIT_OID_
HEX
SZ
-
len
)
/
2
);
memset
(
short_oid
.
id
+
(
len
+
1
)
/
2
,
0
,
(
GIT_OID_
RAW
SZ
-
len
)
/
2
);
/* If len < GIT_OID_
HEX
SZ (a strict short oid was given), we have
/* If len < GIT_OID_
RAW
SZ (a strict short oid was given), we have
* 2 options :
* - We always search in the cache first. If we find that short oid is
* ambiguous, we can stop. But in all the other cases, we must then
...
...
src/pack.c
View file @
da6720fc
...
...
@@ -319,9 +319,9 @@ static int pack_index_check(const char *path, struct git_pack_file *p)
static
int
pack_index_open
(
struct
git_pack_file
*
p
)
{
char
*
idx_name
;
int
error
=
0
;
size_t
name_len
,
base_len
;
size_t
name_len
;
git_buf
idx_name
=
GIT_BUF_INIT
;
if
(
p
->
index_version
>
-
1
)
return
0
;
...
...
@@ -329,22 +329,23 @@ static int pack_index_open(struct git_pack_file *p)
name_len
=
strlen
(
p
->
pack_name
);
assert
(
name_len
>
strlen
(
".pack"
));
/* checked by git_pack_file alloc */
if
((
idx_name
=
git__malloc
(
name_len
))
==
NULL
)
git_buf_grow
(
&
idx_name
,
name_len
);
git_buf_put
(
&
idx_name
,
p
->
pack_name
,
name_len
-
strlen
(
".pack"
));
git_buf_puts
(
&
idx_name
,
".idx"
);
if
(
git_buf_oom
(
&
idx_name
))
{
giterr_set_oom
();
return
-
1
;
base_len
=
name_len
-
strlen
(
".pack"
);
memcpy
(
idx_name
,
p
->
pack_name
,
base_len
);
memcpy
(
idx_name
+
base_len
,
".idx"
,
sizeof
(
".idx"
));
}
if
((
error
=
git_mutex_lock
(
&
p
->
lock
))
<
0
)
{
git_
_free
(
idx_name
);
git_
buf_free
(
&
idx_name
);
return
error
;
}
if
(
p
->
index_version
==
-
1
)
error
=
pack_index_check
(
idx_name
,
p
);
error
=
pack_index_check
(
idx_name
.
ptr
,
p
);
git_
_free
(
idx_name
);
git_
buf_free
(
&
idx_name
);
git_mutex_unlock
(
&
p
->
lock
);
...
...
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