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
5189beb0
Commit
5189beb0
authored
Feb 16, 2019
by
lhchavez
Committed by
Patrick Steinhardt
May 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a memory leak in odb_otype_fast()
This change frees a copy of a cached object in odb_otype_fast().
parent
572e4d8c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
src/odb.c
+1
-0
tests/odb/mixed.c
+21
-0
No files found.
src/odb.c
View file @
5189beb0
...
...
@@ -1124,6 +1124,7 @@ static int odb_otype_fast(git_object_t *type_p, git_odb *db, const git_oid *id)
if
((
object
=
git_cache_get_raw
(
odb_cache
(
db
),
id
))
!=
NULL
)
{
*
type_p
=
object
->
cached
.
type
;
git_odb_object_free
(
object
);
return
0
;
}
...
...
tests/odb/mixed.c
View file @
5189beb0
...
...
@@ -263,3 +263,24 @@ void test_odb_mixed__expand_ids(void)
git__free
(
ids
);
}
void
test_odb_mixed__expand_ids_cached
(
void
)
{
git_odb_expand_id
*
ids
;
size_t
i
,
num
;
/* test looking for the actual (correct) types after accessing the object */
setup_prefix_query
(
&
ids
,
&
num
);
for
(
i
=
0
;
i
<
num
;
i
++
)
{
git_odb_object
*
obj
;
if
(
ids
[
i
].
type
==
GIT_OBJECT_ANY
)
continue
;
cl_git_pass
(
git_odb_read_prefix
(
&
obj
,
_odb
,
&
ids
[
i
].
id
,
ids
[
i
].
length
));
git_odb_object_free
(
obj
);
}
cl_git_pass
(
git_odb_expand_ids
(
_odb
,
ids
,
num
));
assert_found_objects
(
ids
);
git__free
(
ids
);
}
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