diff options
| author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-09-19 20:41:03 +0200 | 
|---|---|---|
| committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-09-19 20:41:03 +0200 | 
| commit | c18b58899e6cad293983fbe522d241bc6a7ce436 (patch) | |
| tree | f076ea8b0eac997e49f40f6a7fc50187a009857f | |
| parent | 62c8054dbe5d590a7f2d36e4e5176996215e9aa7 (diff) | |
| download | hiredict-c18b58899e6cad293983fbe522d241bc6a7ce436.tar.xz | |
Use auxiliary variable to store reply before free'ing the list
| -rw-r--r-- | hiredis.c | 4 | 
1 files changed, 3 insertions, 1 deletions
@@ -274,6 +274,7 @@ static int processItem(redisReader *r) {  #define READ_BUFFER_SIZE 2048  static redisReply *redisReadReply(int fd) { +    redisReply *reply;      redisReader r;      int bytes; @@ -319,9 +320,10 @@ static redisReply *redisReadReply(int fd) {              if (processItem(&r) < 0)                  break;      } +    reply = r.rlist[0];      free(r.buf);      free(r.rlist); -    return r.rlist[0]; +    return reply;  }  /* Helper function for redisCommand(). It's used to append the next argument  | 
