summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authoryoav-steinberg <yoav@monfort.co.il>2021-10-05 12:17:36 +0300
committerGitHub <noreply@github.com>2021-10-05 12:17:36 +0300
commit83478e6102bd86d077e64bb40b0903f8a06905b1 (patch)
treeba0dba6e4c2db5137e84a3e132da71d3eb468503 /tests
parent0f8b634cd5cdfd77696d34d744dfc25fa97f3b73 (diff)
downloadredis-83478e6102bd86d077e64bb40b0903f8a06905b1.tar.gz
argv mem leak during multi command execution. (#9598)
Changes in #9528 lead to memory leak if the command implementation used rewriteClientCommandArgument inside MULTI-EXEC. Adding an explicit test for that case since the test that uncovered it didn't specifically target this scenario
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/protocol.tcl17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/protocol.tcl b/tests/unit/protocol.tcl
index 4f185d9bd..ec08e2d36 100644
--- a/tests/unit/protocol.tcl
+++ b/tests/unit/protocol.tcl
@@ -203,6 +203,23 @@ start_server {tags {"protocol network"}} {
r mset {*}$args
assert_equal [r get "{k}2"] v2
}
+
+ test "test argument rewriting - issue 9598" {
+ # INCRBYFLOAT uses argument rewriting for correct float value propagation.
+ # We use it to make sure argument rewriting works properly. It's important
+ # this test is run under valgrind to verify there are no memory leaks in
+ # arg buffer handling.
+ r flushdb
+
+ # Test normal argument handling
+ r set k 0
+ assert_equal [r incrbyfloat k 1.0] 1
+
+ # Test argument handing in multi-state buffers
+ r multi
+ r incrbyfloat k 1.0
+ assert_equal [r exec] 2
+ }
}