Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
RedisLabs Raft
Commits
e34e4e62
Commit
e34e4e62
authored
Feb 11, 2016
by
Willem Thiart
Browse files
Fix: avoid pointer deference on NULL from calloc
parent
07241e77
Changes
3
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
e34e4e62
...
@@ -16,6 +16,8 @@ UNAME := $(shell uname)
...
@@ -16,6 +16,8 @@ UNAME := $(shell uname)
ifeq
($(UNAME), Darwin)
ifeq
($(UNAME), Darwin)
SHAREDFLAGS
=
-dynamiclib
SHAREDFLAGS
=
-dynamiclib
SHAREDEXT
=
dylib
SHAREDEXT
=
dylib
# We need to include the El Capitan specific /usr/includes, aargh
CFLAGS
+=
-I
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/
else
else
SHAREDFLAGS
=
-shared
SHAREDFLAGS
=
-shared
SHAREDEXT
=
so
SHAREDEXT
=
so
...
...
src/raft_log.c
View file @
e34e4e62
...
@@ -71,6 +71,8 @@ static void __ensurecapacity(log_private_t * me)
...
@@ -71,6 +71,8 @@ static void __ensurecapacity(log_private_t * me)
log_t
*
log_new
()
log_t
*
log_new
()
{
{
log_private_t
*
me
=
(
log_private_t
*
)
calloc
(
1
,
sizeof
(
log_private_t
));
log_private_t
*
me
=
(
log_private_t
*
)
calloc
(
1
,
sizeof
(
log_private_t
));
if
(
!
me
)
return
NULL
;
me
->
size
=
INITIAL_CAPACITY
;
me
->
size
=
INITIAL_CAPACITY
;
me
->
count
=
0
;
me
->
count
=
0
;
me
->
back
=
in
(
me
)
->
front
=
0
;
me
->
back
=
in
(
me
)
->
front
=
0
;
...
...
src/raft_node.c
View file @
e34e4e62
...
@@ -36,6 +36,8 @@ raft_node_t* raft_node_new(void* udata, int id)
...
@@ -36,6 +36,8 @@ raft_node_t* raft_node_new(void* udata, int id)
{
{
raft_node_private_t
*
me
;
raft_node_private_t
*
me
;
me
=
(
raft_node_private_t
*
)
calloc
(
1
,
sizeof
(
raft_node_private_t
));
me
=
(
raft_node_private_t
*
)
calloc
(
1
,
sizeof
(
raft_node_private_t
));
if
(
!
me
)
return
NULL
;
me
->
udata
=
udata
;
me
->
udata
=
udata
;
me
->
next_idx
=
1
;
me
->
next_idx
=
1
;
me
->
match_idx
=
0
;
me
->
match_idx
=
0
;
...
...
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