mant1988 / redis

Automatically exported from code.google.com/p/redis
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

redis-cli: memory is leaking at each command #464

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
>>What version of Redis you are using, in what kind of Operating System?

Redis 2.2 on Linux.

>> What is the problem you are experiencing?

Memory leak in redis-cli. A small amount of memory is lost at
each command execution.

>> What steps will reproduce the problem?

Just pipe in a lot of commands in redis-cli, and look at
the memory consumption growing.

>> Please provide any additional information below.

I believe this is due to the fact argvlen is never deallocated
in function cliSendCommand.

Suggested fix:

@@ -489,9 +489,13 @@
             }
         }

-        if (cliReadReply(output_raw) != REDIS_OK)
+        if (cliReadReply(output_raw) != REDIS_OK) {
+            free( argvlen );
             return REDIS_ERR;
     }
+    }
+
+    free( argvlen );
     return REDIS_OK;
 }

This is a minor issue actually since people injecting a lot of
commands in redis-cli for scripting would be better served by
using Perl/Python/Ruby/Lua.

Regards,
Didier.

Original issue reported on code.google.com by didier...@gmail.com on 22 Feb 2011 at 9:18

GoogleCodeExporter commented 8 years ago
Minor issue but we hate memory leaks ;) Thanks.

Original comment by anti...@gmail.com on 22 Feb 2011 at 10:10

GoogleCodeExporter commented 8 years ago
Thanks for spotting this, added.

Original comment by pcnoordh...@gmail.com on 6 Mar 2011 at 8:16