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
557bd1f4
Commit
557bd1f4
authored
Jan 14, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2043 from arthurschreiber/arthur/fix-memory-leaks
Fix a bunch of memory leaks.
parents
0d5d0ea8
24953757
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
10 deletions
+19
-10
src/blame.c
+0
-1
src/config.c
+1
-0
src/config_file.c
+3
-1
src/indexer.c
+12
-7
src/pathspec.c
+3
-1
No files found.
src/blame.c
View file @
557bd1f4
...
...
@@ -121,7 +121,6 @@ git_blame* git_blame__alloc(
git_vector_insert
(
&
gbr
->
paths
,
git__strdup
(
path
))
<
0
)
{
git_blame_free
(
gbr
);
git__free
(
gbr
);
return
NULL
;
}
...
...
src/config.c
View file @
557bd1f4
...
...
@@ -458,6 +458,7 @@ int git_config_iterator_glob_new(git_config_iterator **out, const git_config *cf
if
((
result
=
regcomp
(
&
iter
->
regex
,
regexp
,
REG_EXTENDED
))
<
0
)
{
giterr_set_regex
(
&
iter
->
regex
,
result
);
regfree
(
&
iter
->
regex
);
git__free
(
iter
);
return
-
1
;
}
...
...
src/config_file.c
View file @
557bd1f4
...
...
@@ -1072,8 +1072,10 @@ static int config_parse(diskfile_backend *cfg_file, struct reader *reader, git_c
git_buf_printf
(
&
buf
,
"%s.%s"
,
current_section
,
var_name
);
git__free
(
var_name
);
if
(
git_buf_oom
(
&
buf
))
if
(
git_buf_oom
(
&
buf
))
{
git__free
(
var_value
);
return
-
1
;
}
var
->
entry
->
name
=
git_buf_detach
(
&
buf
);
var
->
entry
->
value
=
var_value
;
...
...
src/indexer.c
View file @
557bd1f4
...
...
@@ -353,7 +353,7 @@ static int hash_and_save(git_indexer *idx, git_rawobj *obj, git_off_t entry_star
git_oid
oid
;
size_t
entry_size
;
struct
entry
*
entry
;
struct
git_pack_entry
*
pentry
;
struct
git_pack_entry
*
pentry
=
NULL
;
entry
=
git__calloc
(
1
,
sizeof
(
*
entry
));
GITERR_CHECK_ALLOC
(
entry
);
...
...
@@ -377,6 +377,7 @@ static int hash_and_save(git_indexer *idx, git_rawobj *obj, git_off_t entry_star
return
save_entry
(
idx
,
entry
,
pentry
,
entry_start
);
on_error:
git__free
(
pentry
);
git__free
(
entry
);
git__free
(
obj
->
data
);
return
-
1
;
...
...
@@ -632,7 +633,7 @@ static int inject_object(git_indexer *idx, git_oid *id)
{
git_odb_object
*
obj
;
struct
entry
*
entry
;
struct
git_pack_entry
*
pentry
;
struct
git_pack_entry
*
pentry
=
NULL
;
git_oid
foo
=
{{
0
}};
unsigned
char
hdr
[
64
];
git_buf
buf
=
GIT_BUF_INIT
;
...
...
@@ -641,9 +642,6 @@ static int inject_object(git_indexer *idx, git_oid *id)
size_t
len
,
hdr_len
;
int
error
;
entry
=
git__calloc
(
1
,
sizeof
(
*
entry
));
GITERR_CHECK_ALLOC
(
entry
);
entry_start
=
seek_back_trailer
(
idx
);
if
(
git_odb_read
(
&
obj
,
idx
->
odb
,
id
)
<
0
)
...
...
@@ -652,6 +650,9 @@ static int inject_object(git_indexer *idx, git_oid *id)
data
=
git_odb_object_data
(
obj
);
len
=
git_odb_object_size
(
obj
);
entry
=
git__calloc
(
1
,
sizeof
(
*
entry
));
GITERR_CHECK_ALLOC
(
entry
);
entry
->
crc
=
crc32
(
0L
,
Z_NULL
,
0
);
/* Write out the object header */
...
...
@@ -682,10 +683,14 @@ static int inject_object(git_indexer *idx, git_oid *id)
git_oid_cpy
(
&
entry
->
oid
,
id
);
idx
->
off
=
entry_start
+
hdr_len
+
len
;
if
((
error
=
save_entry
(
idx
,
entry
,
pentry
,
entry_start
))
<
0
)
git__free
(
pentry
);
error
=
save_entry
(
idx
,
entry
,
pentry
,
entry_start
);
cleanup:
if
(
error
)
{
git__free
(
entry
);
git__free
(
pentry
);
}
git_odb_object_free
(
obj
);
return
error
;
}
...
...
src/pathspec.c
View file @
557bd1f4
...
...
@@ -89,8 +89,10 @@ int git_pathspec__vinit(
if
(
ret
==
GIT_ENOTFOUND
)
{
git__free
(
match
);
continue
;
}
else
if
(
ret
<
0
)
}
else
if
(
ret
<
0
)
{
git__free
(
match
);
return
ret
;
}
if
(
git_vector_insert
(
vspec
,
match
)
<
0
)
return
-
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