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
redis
Commits
9506c860
Unverified
Commit
9506c860
authored
Jan 13, 2020
by
Salvatore Sanfilippo
Committed by
GitHub
Jan 13, 2020
Browse files
Merge pull request #6739 from trevor211/fixMemoryLeak
Fix potential memory leak of rioWriteBulkStreamID().
parents
baa88a1c
d6a13f44
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/aof.c
View file @
9506c860
...
...
@@ -1149,7 +1149,10 @@ int rioWriteBulkStreamID(rio *r,streamID *id) {
int
retval
;
sds
replyid
=
sdscatfmt
(
sdsempty
(),
"%U-%U"
,
id
->
ms
,
id
->
seq
);
if
((
retval
=
rioWriteBulkString
(
r
,
replyid
,
sdslen
(
replyid
)))
==
0
)
return
0
;
if
((
retval
=
rioWriteBulkString
(
r
,
replyid
,
sdslen
(
replyid
)))
==
0
)
{
sdsfree
(
replyid
);
return
0
;
}
sdsfree
(
replyid
);
return
retval
;
}
...
...
src/cluster.c
View file @
9506c860
...
...
@@ -157,7 +157,10 @@ int clusterLoadConfig(char *filename) {
}
/* Regular config lines have at least eight fields */
if
(
argc
<
8
)
goto
fmterr
;
if
(
argc
<
8
)
{
sdsfreesplitres
(
argv
,
argc
);
goto
fmterr
;
}
/* Create this node if it does not exist */
n
=
clusterLookupNode
(
argv
[
0
]);
...
...
@@ -166,7 +169,10 @@ int clusterLoadConfig(char *filename) {
clusterAddNode
(
n
);
}
/* Address and port */
if
((
p
=
strrchr
(
argv
[
1
],
':'
))
==
NULL
)
goto
fmterr
;
if
((
p
=
strrchr
(
argv
[
1
],
':'
))
==
NULL
)
{
sdsfreesplitres
(
argv
,
argc
);
goto
fmterr
;
}
*
p
=
'\0'
;
memcpy
(
n
->
ip
,
argv
[
1
],
strlen
(
argv
[
1
])
+
1
);
char
*
port
=
p
+
1
;
...
...
@@ -247,7 +253,10 @@ int clusterLoadConfig(char *filename) {
*
p
=
'\0'
;
direction
=
p
[
1
];
/* Either '>' or '<' */
slot
=
atoi
(
argv
[
j
]
+
1
);
if
(
slot
<
0
||
slot
>=
CLUSTER_SLOTS
)
goto
fmterr
;
if
(
slot
<
0
||
slot
>=
CLUSTER_SLOTS
)
{
sdsfreesplitres
(
argv
,
argc
);
goto
fmterr
;
}
p
+=
3
;
cn
=
clusterLookupNode
(
p
);
if
(
!
cn
)
{
...
...
@@ -267,8 +276,14 @@ int clusterLoadConfig(char *filename) {
}
else
{
start
=
stop
=
atoi
(
argv
[
j
]);
}
if
(
start
<
0
||
start
>=
CLUSTER_SLOTS
)
goto
fmterr
;
if
(
stop
<
0
||
stop
>=
CLUSTER_SLOTS
)
goto
fmterr
;
if
(
start
<
0
||
start
>=
CLUSTER_SLOTS
)
{
sdsfreesplitres
(
argv
,
argc
);
goto
fmterr
;
}
if
(
stop
<
0
||
stop
>=
CLUSTER_SLOTS
)
{
sdsfreesplitres
(
argv
,
argc
);
goto
fmterr
;
}
while
(
start
<=
stop
)
clusterAddSlot
(
n
,
start
++
);
}
...
...
src/hyperloglog.c
View file @
9506c860
...
...
@@ -1535,6 +1535,7 @@ void pfdebugCommand(client *c) {
sds
decoded
=
sdsempty
();
if
(
hdr
->
encoding
!=
HLL_SPARSE
)
{
sdsfree
(
decoded
);
addReplyError
(
c
,
"HLL encoding is not sparse"
);
return
;
}
...
...
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