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
e79a2998
Commit
e79a2998
authored
Apr 25, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2299 from mekishizufu/fix_leaks
Plug some leaks
parents
8443ed6c
7b8d564d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
src/filter.c
+3
-2
tests/reset/default.c
+3
-6
No files found.
src/filter.c
View file @
e79a2998
...
@@ -617,7 +617,7 @@ int git_filter_list_apply_to_data(
...
@@ -617,7 +617,7 @@ int git_filter_list_apply_to_data(
si
=
di
;
/* swap buffers */
si
=
di
;
/* swap buffers */
}
else
{
}
else
{
tgt
->
size
=
0
;
tgt
->
size
=
0
;
return
error
;
goto
cleanup
;
}
}
}
}
...
@@ -625,9 +625,10 @@ int git_filter_list_apply_to_data(
...
@@ -625,9 +625,10 @@ int git_filter_list_apply_to_data(
if
(
si
!=
1
)
if
(
si
!=
1
)
git_buf_swap
(
dbuffer
[
0
],
dbuffer
[
1
]);
git_buf_swap
(
dbuffer
[
0
],
dbuffer
[
1
]);
cleanup:
git_buf_free
(
&
local
);
/* don't leak if we allocated locally */
git_buf_free
(
&
local
);
/* don't leak if we allocated locally */
return
0
;
return
error
;
}
}
int
git_filter_list_apply_to_file
(
int
git_filter_list_apply_to_file
(
...
...
tests/reset/default.c
View file @
e79a2998
...
@@ -185,23 +185,20 @@ void test_reset_default__resetting_unknown_filepaths_does_not_fail(void)
...
@@ -185,23 +185,20 @@ void test_reset_default__resetting_unknown_filepaths_does_not_fail(void)
void
test_reset_default__staged_rename_reset_delete
(
void
)
void
test_reset_default__staged_rename_reset_delete
(
void
)
{
{
git_index
*
idx
;
git_index_entry
entry
;
git_index_entry
entry
;
const
git_index_entry
*
existing
;
const
git_index_entry
*
existing
;
char
*
paths
[]
=
{
"new.txt"
};
char
*
paths
[]
=
{
"new.txt"
};
initialize
(
"testrepo2"
);
initialize
(
"testrepo2"
);
cl_git_pass
(
git_repository_index
(
&
idx
,
_repo
));
existing
=
git_index_get_bypath
(
_index
,
"new.txt"
,
0
);
existing
=
git_index_get_bypath
(
idx
,
"new.txt"
,
0
);
cl_assert
(
existing
);
cl_assert
(
existing
);
memcpy
(
&
entry
,
existing
,
sizeof
(
entry
));
memcpy
(
&
entry
,
existing
,
sizeof
(
entry
));
cl_git_pass
(
git_index_remove_bypath
(
id
x
,
"new.txt"
));
cl_git_pass
(
git_index_remove_bypath
(
_inde
x
,
"new.txt"
));
entry
.
path
=
"renamed.txt"
;
entry
.
path
=
"renamed.txt"
;
cl_git_pass
(
git_index_add
(
id
x
,
&
entry
));
cl_git_pass
(
git_index_add
(
_inde
x
,
&
entry
));
_pathspecs
.
strings
=
paths
;
_pathspecs
.
strings
=
paths
;
_pathspecs
.
count
=
1
;
_pathspecs
.
count
=
1
;
...
...
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