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
52db745c
Commit
52db745c
authored
Jun 01, 2020
by
antirez
Browse files
Threaded core commands: fix LCS leaks on syntax error.
parent
a30678e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_string.c
View file @
52db745c
...
@@ -679,7 +679,7 @@ void stralgoLCS(client *c) {
...
@@ -679,7 +679,7 @@ void stralgoLCS(client *c) {
}
else
if
(
!
strcasecmp
(
opt
,
"STRINGS"
)
&&
moreargs
>
1
)
{
}
else
if
(
!
strcasecmp
(
opt
,
"STRINGS"
)
&&
moreargs
>
1
)
{
if
(
obja
!=
NULL
)
{
if
(
obja
!=
NULL
)
{
addReplyError
(
c
,
"Either use STRINGS or KEYS"
);
addReplyError
(
c
,
"Either use STRINGS or KEYS"
);
return
;
goto
syntaxerr
;
}
}
obja
=
c
->
argv
[
j
+
1
];
obja
=
c
->
argv
[
j
+
1
];
objb
=
c
->
argv
[
j
+
2
];
objb
=
c
->
argv
[
j
+
2
];
...
@@ -691,7 +691,7 @@ void stralgoLCS(client *c) {
...
@@ -691,7 +691,7 @@ void stralgoLCS(client *c) {
}
else
if
(
!
strcasecmp
(
opt
,
"KEYS"
)
&&
moreargs
>
1
)
{
}
else
if
(
!
strcasecmp
(
opt
,
"KEYS"
)
&&
moreargs
>
1
)
{
if
(
obja
!=
NULL
)
{
if
(
obja
!=
NULL
)
{
addReplyError
(
c
,
"Either use STRINGS or KEYS"
);
addReplyError
(
c
,
"Either use STRINGS or KEYS"
);
return
;
goto
syntaxerr
;
}
}
obja
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
j
+
1
]);
obja
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
j
+
1
]);
objb
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
j
+
2
]);
objb
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
j
+
2
]);
...
@@ -701,7 +701,7 @@ void stralgoLCS(client *c) {
...
@@ -701,7 +701,7 @@ void stralgoLCS(client *c) {
data_from_key
=
1
;
data_from_key
=
1
;
}
else
{
}
else
{
addReply
(
c
,
shared
.
syntaxerr
);
addReply
(
c
,
shared
.
syntaxerr
);
return
;
goto
syntaxerr
;
}
}
}
}
...
@@ -726,5 +726,11 @@ void stralgoLCS(client *c) {
...
@@ -726,5 +726,11 @@ void stralgoLCS(client *c) {
opt
->
obja
=
a
;
opt
->
obja
=
a
;
opt
->
objb
=
b
;
opt
->
objb
=
b
;
executeThreadedCommand
(
c
,
stralgoLCSThreadedPart
,
opt
);
executeThreadedCommand
(
c
,
stralgoLCSThreadedPart
,
opt
);
return
;
syntaxerr:
if
(
obja
)
decrRefCount
(
obja
);
if
(
objb
)
decrRefCount
(
obja
);
zfree
(
opt
);
}
}
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