uglide/qredisclient

Memory leak when parsing MultiBulk response

TheoTusch opened this issue · 4 comments

Hi there,

I'm new to this site and don't know if there is a better way of doing this, but I would like to report an issue I had when using qredisclient:

I think there is a memory leak when parsing MultiBulk responses in RedisClient::Response::parse():

A new object is created in reply = convertUnsafeArray(reply);. By doing that, we lose track of the object that reply pointed to before and it never gets deleted properly.
Actually, not only is the object that reply pointed to (a QVariant containing QVector<QVariant*>) lost, but also the QVariants that it in turn pointed to.

There should be a deep delete of the original reply.

Please have a look and see if you agree.

Best Regards
Theo

Hello @TheoTusch
Please review my fix here https://github.com/uglide/qredisclient/pull/8/files
Thanks!

Hi @uglide,

looks good and fixes it for me.

Regards
Theo

Hi @uglide ,

I had add the fixes to response.cpp , but when I run command like "keys *", memory keep rising. I did this test in Redis Desktop Manager, the result is same. I don't know the reason, maybe you can have a look.

Regards.

@nilarcs I investigated the problem and fixed all memory leaks in latest commit.