sweinteract/sweinteract huggingface dataset:
Repository: redis/redis (c)

Issue:
[BUG] module.c RM_GetCommandKeysWithFlags should free keysResult
**Describe the bug**

redis module RM_GetCommandKeysWithFlags should always free keys result




Patch:
diff --git a/src/module.c b/src/module.c
index 216030809aa..e1f40555dd4 100644
--- a/src/module.c
+++ b/src/module.c
@@ -14176,6 +14176,7 @@ int *RM_GetCommandKeysWithFlags(RedisModuleCtx *ctx, RedisModuleString **argv, i
             (*out_flags)[i] = moduleConvertKeySpecsFlags(result.keys[i].flags, 0);
     }
 
+    getKeysFreeResult(&result);
     return res;
 }
 


Test patch:
diff --git a/tests/unit/moduleapi/getkeys.tcl b/tests/unit/moduleapi/getkeys.tcl
index b84bb0f739c..48f97ddf430 100644
--- a/tests/unit/moduleapi/getkeys.tcl
+++ b/tests/unit/moduleapi/getkeys.tcl
@@ -58,6 +58,15 @@ start_server {tags {"modules"}} {
         set _ $e
     } {*EINVAL*}
 
+    test "introspect with > MAX_KEYS_BUFFER keys triggers RM_GetCommandKeysWithFlags heap alloc" {
+        set args {}
+        for {set i 0} {$i < 7} {incr i} {
+            lappend args key k$i
+        }
+        set reply [r getkeys.introspect 1 getkeys.command_with_flags {*}$args]
+        assert_equal {{k0 RO} {k1 RO} {k2 RO} {k3 RO} {k4 RO} {k5 RO} {k6 RO}} $reply
+    }
+
     # user that can only read from "read" keys, write to "write" keys, and read+write to "RW" keys
     r ACL setuser testuser +@all %R~read* %W~write* %RW~rw*
Repository: redis-rs/redis-rs (rust)

Issue:
No way to explicitly call `HMGET`
Hi, it seems that there's no way to explicitly call `HMGET`, instead we rely on using `hget` with multiple params. This makes it hard to write generic code, where if we request less than 2 fields inside the `hget`, we'll get a single value instead of key-value pairs, which we might be unable to parse.


Patch:
diff --git a/redis/src/commands/mod.rs b/redis/src/commands/mod.rs
index 988452171..9e60932eb 100644
--- a/redis/src/commands/mod.rs
+++ b/redis/src/commands/mod.rs
@@ -494,6 +494,12 @@ implement_commands! {
         cmd(if field.num_of_args() <= 1 { "HGET" } else { "HMGET" }).arg(key).arg(field)
     }
 
+    /// Gets multiple fields from a hash.
+    /// [Redis Docs](https://redis.io/commands/HMGET)
+    fn hmget<K: ToRedisArgs, F: ToRedisArgs>(key: K, fields: F) -> (Vec<String>) {
+        cmd("HMGET").arg(key).arg(fields)
+    }
+
     /// Get the value of one or more fields of a given hash key, and optionally set their expiration
     /// [Redis Docs](https://redis.io/commands/HGETEX)
     fn hget_ex<K: ToRedisArgs, F: ToRedisArgs>(key: K, fields: F, expire_at: Expiry) -> (Vec<String>) {


Test patch:
diff --git a/redis/tests/test_basic.rs b/redis/tests/test_basic.rs
index 674846c7b..129ace10a 100644
--- a/redis/tests/test_basic.rs
+++ b/redis/tests/test_basic.rs
@@ -2083,6 +2083,10 @@ mod basic {
             redis::Commands::hget(&mut con, "my_hash", &["f2", "f4"]),
             Ok((2, 8))
         );
+        assert_eq!(
+            redis::Commands::hmget(&mut con, "my_hash", &["f2", "f4"]),
+            Ok((2, 8))
+        );
         assert_eq!(con.hincr("my_hash", "f1", 1), Ok(2.0));
         assert_eq!(con.hincr("my_hash", "f2", 1.5), Ok(3.5));
         assert_eq!(con.hexists("my_hash", "f2"), Ok(true));