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
7e3ed419
Commit
7e3ed419
authored
Dec 11, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix up some valgrind leaks and warnings
parent
7697e541
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
18 deletions
+28
-18
src/diff_tform.c
+14
-15
src/pack-objects.c
+12
-1
src/path.c
+1
-1
src/submodule.c
+1
-1
No files found.
src/diff_tform.c
View file @
7e3ed419
...
...
@@ -280,11 +280,8 @@ static int normalize_find_opts(
git_repository_config__weakptr
(
&
cfg
,
diff
->
repo
)
<
0
)
return
-
1
;
if
(
given
)
{
if
(
given
)
memcpy
(
opts
,
given
,
sizeof
(
*
opts
));
}
else
{
GIT_INIT_STRUCTURE
(
opts
,
GIT_DIFF_FIND_OPTIONS_VERSION
);
}
if
(
!
given
||
(
given
->
flags
&
GIT_DIFF_FIND_ALL
)
==
GIT_DIFF_FIND_BY_CONFIG
)
...
...
@@ -815,11 +812,11 @@ int git_diff_find_similar(
int
error
=
0
,
result
;
uint16_t
similarity
;
git_diff_delta
*
src
,
*
tgt
;
git_diff_find_options
opts
;
git_diff_find_options
opts
=
GIT_DIFF_FIND_OPTIONS_INIT
;
size_t
num_deltas
,
num_srcs
=
0
,
num_tgts
=
0
;
size_t
tried_srcs
=
0
,
tried_tgts
=
0
;
size_t
num_rewrites
=
0
,
num_updates
=
0
,
num_bumped
=
0
;
void
**
sigcache
;
/* cache of similarity metric file signatures */
void
**
sigcache
=
NULL
;
/* cache of similarity metric file signatures */
diff_find_match
*
tgt2src
=
NULL
;
diff_find_match
*
src2tgt
=
NULL
;
diff_find_match
*
tgt2src_copy
=
NULL
;
...
...
@@ -829,15 +826,15 @@ int git_diff_find_similar(
if
((
error
=
normalize_find_opts
(
diff
,
&
opts
,
given_opts
))
<
0
)
return
error
;
/* No flags set; nothing to do */
if
((
opts
.
flags
&
GIT_DIFF_FIND_ALL
)
==
0
)
return
0
;
num_deltas
=
diff
->
deltas
.
length
;
/* TODO: maybe abort if deltas.length > rename_limit ??? */
if
(
!
git__is_uint32
(
num_deltas
))
return
0
;
goto
cleanup
;
/* No flags set; nothing to do */
if
((
opts
.
flags
&
GIT_DIFF_FIND_ALL
)
==
0
)
goto
cleanup
;
sigcache
=
git__calloc
(
num_deltas
*
2
,
sizeof
(
void
*
));
GITERR_CHECK_ALLOC
(
sigcache
);
...
...
@@ -1112,11 +1109,13 @@ cleanup:
git__free
(
src2tgt
);
git__free
(
tgt2src_copy
);
for
(
t
=
0
;
t
<
num_deltas
*
2
;
++
t
)
{
if
(
sigcache
[
t
]
!=
NULL
)
opts
.
metric
->
free_signature
(
sigcache
[
t
],
opts
.
metric
->
payload
);
if
(
sigcache
)
{
for
(
t
=
0
;
t
<
num_deltas
*
2
;
++
t
)
{
if
(
sigcache
[
t
]
!=
NULL
)
opts
.
metric
->
free_signature
(
sigcache
[
t
],
opts
.
metric
->
payload
);
}
git__free
(
sigcache
);
}
git__free
(
sigcache
);
if
(
!
given_opts
||
!
given_opts
->
metric
)
git__free
(
opts
.
metric
);
...
...
src/pack-objects.c
View file @
7e3ed419
...
...
@@ -332,8 +332,10 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po)
git_hash_update
(
&
pb
->
ctx
,
data
,
size
)
<
0
)
goto
on_error
;
if
(
po
->
delta_data
)
if
(
po
->
delta_data
)
{
git__free
(
po
->
delta_data
);
po
->
delta_data
=
NULL
;
}
git_odb_object_free
(
obj
);
git_buf_free
(
&
zbuf
);
...
...
@@ -612,6 +614,15 @@ static int write_pack(git_packbuilder *pb,
error
=
cb
(
entry_oid
.
id
,
GIT_OID_RAWSZ
,
data
);
done
:
/* if callback cancelled writing, we must still free delta_data */
for
(
;
i
<
pb
->
nr_objects
;
++
i
)
{
po
=
write_order
[
i
];
if
(
po
->
delta_data
)
{
git__free
(
po
->
delta_data
);
po
->
delta_data
=
NULL
;
}
}
git__free
(
write_order
);
git_buf_free
(
&
buf
);
return
error
;
...
...
src/path.c
View file @
7e3ed419
...
...
@@ -784,7 +784,7 @@ int git_path_iconv(git_path_iconv_t *ic, char **in, size_t *inlen)
return
0
;
while
(
1
)
{
if
(
git_buf_grow
(
&
ic
->
buf
,
wantlen
)
<
0
)
if
(
git_buf_grow
(
&
ic
->
buf
,
wantlen
+
1
)
<
0
)
return
-
1
;
nfc
=
ic
->
buf
.
ptr
+
ic
->
buf
.
size
;
...
...
src/submodule.c
View file @
7e3ed419
...
...
@@ -1148,7 +1148,7 @@ static int submodule_load_from_config(
*/
if
(
path
)
return
0
;
goto
done
;
/* copy other properties into submodule entry */
if
(
strcasecmp
(
property
,
"url"
)
==
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