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
c6d2a2c0
Commit
c6d2a2c0
authored
Dec 29, 2011
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed up memory leaks
parent
73b51450
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
src/attr.c
+1
-3
src/attr_file.c
+14
-6
No files found.
src/attr.c
View file @
c6d2a2c0
...
...
@@ -207,10 +207,8 @@ int git_attr_add_macro(
if
(
error
==
GIT_SUCCESS
)
error
=
git_attr_cache__insert_macro
(
repo
,
macro
);
if
(
error
<
GIT_SUCCESS
)
{
if
(
error
<
GIT_SUCCESS
)
git_attr_rule__free
(
macro
);
git__free
(
macro
);
}
return
error
;
}
...
...
src/attr_file.c
View file @
c6d2a2c0
...
...
@@ -8,6 +8,7 @@ const char *git_attr__false = "[internal]__FALSE__";
static
int
git_attr_fnmatch__parse
(
git_attr_fnmatch
*
spec
,
const
char
**
base
);
static
int
sort_by_hash_and_name
(
const
void
*
a_raw
,
const
void
*
b_raw
);
static
void
git_attr_rule__clear
(
git_attr_rule
*
rule
);
int
git_attr_cache__insert_macro
(
git_repository
*
repo
,
git_attr_rule
*
macro
)
{
...
...
@@ -72,7 +73,7 @@ int git_attr_file__from_buffer(
/* if the rule wasn't a pattern, on to the next */
if
(
error
!=
GIT_SUCCESS
)
{
git_attr_rule__
free
(
rule
);
/* free anything partially allocated
*/
git_attr_rule__
clear
(
rule
);
/* reset rule contents
*/
if
(
error
==
GIT_ENOTFOUND
)
error
=
GIT_SUCCESS
;
}
else
{
...
...
@@ -82,9 +83,8 @@ int git_attr_file__from_buffer(
cleanup:
if
(
error
!=
GIT_SUCCESS
)
{
git__free
(
rule
);
git_
attr_rule_
_free
(
rule
);
git_attr_file__free
(
attrs
);
git__free
(
attrs
);
}
else
{
*
out
=
attrs
;
}
...
...
@@ -122,14 +122,15 @@ void git_attr_file__free(git_attr_file *file)
if
(
!
file
)
return
;
git_vector_foreach
(
&
file
->
rules
,
i
,
rule
)
{
git_vector_foreach
(
&
file
->
rules
,
i
,
rule
)
git_attr_rule__free
(
rule
);
}
git_vector_free
(
&
file
->
rules
);
git__free
(
file
->
path
);
file
->
path
=
NULL
;
git__free
(
file
);
}
unsigned
long
git_attr_file__name_hash
(
const
char
*
name
)
...
...
@@ -505,7 +506,7 @@ int git_attr_assignment__parse(
return
error
;
}
void
git_attr_rule__free
(
git_attr_rule
*
rule
)
static
void
git_attr_rule__clear
(
git_attr_rule
*
rule
)
{
unsigned
int
i
;
git_attr_assignment
*
assign
;
...
...
@@ -525,3 +526,10 @@ void git_attr_rule__free(git_attr_rule *rule)
git_vector_free
(
&
rule
->
assigns
);
}
void
git_attr_rule__free
(
git_attr_rule
*
rule
)
{
git_attr_rule__clear
(
rule
);
git__free
(
rule
);
}
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