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
8d6ef4bf
Commit
8d6ef4bf
authored
Jul 15, 2013
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index: fix potential memory leaks
parent
9146f1e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
src/index.c
+9
-3
src/indexer.c
+1
-1
No files found.
src/index.c
View file @
8d6ef4bf
...
@@ -1409,14 +1409,18 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
...
@@ -1409,14 +1409,18 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
if
(
git__strtol32
(
&
tmp
,
buffer
,
&
endptr
,
8
)
<
0
||
if
(
git__strtol32
(
&
tmp
,
buffer
,
&
endptr
,
8
)
<
0
||
!
endptr
||
endptr
==
buffer
||
*
endptr
||
!
endptr
||
endptr
==
buffer
||
*
endptr
||
(
unsigned
)
tmp
>
UINT_MAX
)
(
unsigned
)
tmp
>
UINT_MAX
)
{
index_entry_reuc_free
(
lost
);
return
index_error_invalid
(
"reading reuc entry stage"
);
return
index_error_invalid
(
"reading reuc entry stage"
);
}
lost
->
mode
[
i
]
=
tmp
;
lost
->
mode
[
i
]
=
tmp
;
len
=
(
endptr
+
1
)
-
buffer
;
len
=
(
endptr
+
1
)
-
buffer
;
if
(
size
<=
len
)
if
(
size
<=
len
)
{
index_entry_reuc_free
(
lost
);
return
index_error_invalid
(
"reading reuc entry stage"
);
return
index_error_invalid
(
"reading reuc entry stage"
);
}
size
-=
len
;
size
-=
len
;
buffer
+=
len
;
buffer
+=
len
;
...
@@ -1426,8 +1430,10 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
...
@@ -1426,8 +1430,10 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
if
(
!
lost
->
mode
[
i
])
if
(
!
lost
->
mode
[
i
])
continue
;
continue
;
if
(
size
<
20
)
if
(
size
<
20
)
{
index_entry_reuc_free
(
lost
);
return
index_error_invalid
(
"reading reuc entry oid"
);
return
index_error_invalid
(
"reading reuc entry oid"
);
}
git_oid_fromraw
(
&
lost
->
oid
[
i
],
(
const
unsigned
char
*
)
buffer
);
git_oid_fromraw
(
&
lost
->
oid
[
i
],
(
const
unsigned
char
*
)
buffer
);
size
-=
20
;
size
-=
20
;
...
...
src/indexer.c
View file @
8d6ef4bf
...
@@ -325,7 +325,7 @@ static int hash_and_save(git_indexer_stream *idx, git_rawobj *obj, git_off_t ent
...
@@ -325,7 +325,7 @@ static int hash_and_save(git_indexer_stream *idx, git_rawobj *obj, git_off_t ent
/* FIXME: Parse the object instead of hashing it */
/* FIXME: Parse the object instead of hashing it */
if
(
git_odb__hashobj
(
&
oid
,
obj
)
<
0
)
{
if
(
git_odb__hashobj
(
&
oid
,
obj
)
<
0
)
{
giterr_set
(
GITERR_INDEXER
,
"Failed to hash object"
);
giterr_set
(
GITERR_INDEXER
,
"Failed to hash object"
);
return
-
1
;
goto
on_error
;
}
}
pentry
=
git__calloc
(
1
,
sizeof
(
struct
git_pack_entry
));
pentry
=
git__calloc
(
1
,
sizeof
(
struct
git_pack_entry
));
...
...
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