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
b3f2d4cb
Commit
b3f2d4cb
authored
Jun 21, 2011
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #270 from carlosmn/valgrind
Two memory access fixes
parents
37172582
4cea2f03
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
src/blob.c
+8
-4
src/odb_pack.c
+2
-1
No files found.
src/blob.c
View file @
b3f2d4cb
...
@@ -88,15 +88,19 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
...
@@ -88,15 +88,19 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
git_odb_stream
*
stream
;
git_odb_stream
*
stream
;
struct
stat
st
;
struct
stat
st
;
gitfo_lstat
(
path
,
&
st
);
islnk
=
S_ISLNK
(
st
.
st_mode
);
if
(
repo
->
path_workdir
==
NULL
)
if
(
repo
->
path_workdir
==
NULL
)
return
git__throw
(
GIT_ENOTFOUND
,
"Failed to create blob. (No working directory found)"
);
return
git__throw
(
GIT_ENOTFOUND
,
"Failed to create blob. (No working directory found)"
);
git__joinpath
(
full_path
,
repo
->
path_workdir
,
path
);
git__joinpath
(
full_path
,
repo
->
path_workdir
,
path
);
error
=
gitfo_lstat
(
full_path
,
&
st
);
if
(
error
<
0
)
{
return
git__throw
(
GIT_EOSERR
,
"Failed to stat blob. %s"
,
strerror
(
errno
));
}
islnk
=
S_ISLNK
(
st
.
st_mode
);
if
(
!
islnk
)
{
if
(
!
islnk
)
{
if
((
fd
=
gitfo_open
(
full_path
,
O_RDONLY
))
<
0
)
if
((
fd
=
gitfo_open
(
full_path
,
O_RDONLY
))
<
0
)
return
git__throw
(
GIT_ENOTFOUND
,
"Failed to create blob. Could not open '%s'"
,
full_path
);
return
git__throw
(
GIT_ENOTFOUND
,
"Failed to create blob. Could not open '%s'"
,
full_path
);
...
...
src/odb_pack.c
View file @
b3f2d4cb
...
@@ -1246,7 +1246,8 @@ static int packfile_unpack_compressed(
...
@@ -1246,7 +1246,8 @@ static int packfile_unpack_compressed(
z_stream
stream
;
z_stream
stream
;
unsigned
char
*
buffer
,
*
in
;
unsigned
char
*
buffer
,
*
in
;
buffer
=
git__malloc
(
size
);
buffer
=
git__malloc
(
size
+
1
);
memset
(
buffer
,
0x0
,
size
+
1
);
memset
(
&
stream
,
0
,
sizeof
(
stream
));
memset
(
&
stream
,
0
,
sizeof
(
stream
));
stream
.
next_out
=
buffer
;
stream
.
next_out
=
buffer
;
...
...
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