Fix memory leak in redis backend, fixes #1325