1. 29 Aug, 2019 1 commit
  2. 09 Aug, 2019 1 commit
    • Marcus Geelnard's avatar
      MinGW fix: Use _MSC_VER instead of _WIN32 where appropriate · 85fee256
      Marcus Geelnard authored
      Use _MSC_VER (instead of _WIN32) for things that are specific for
      Visual Studio.
      
      Also remove #include <winsock2.h> from hiredis.h, as it leaks too
      many symbols and defines into the global namespace, which is
      undesirable for a public interface header. Anyone who uses the
      the affected parts of the hiredis API needs to include the
      appropriate headers anyway in order to declare struct timeval
      variables.
      85fee256
  3. 22 Jul, 2019 1 commit
  4. 13 Apr, 2019 1 commit
  5. 11 Mar, 2019 1 commit
  6. 21 Feb, 2019 1 commit
  7. 20 Feb, 2019 5 commits
  8. 26 Sep, 2018 2 commits
  9. 15 Jun, 2017 1 commit
  10. 15 May, 2017 1 commit
  11. 30 Jan, 2017 2 commits
  12. 29 Sep, 2016 1 commit
  13. 27 Oct, 2015 1 commit
  14. 27 Jul, 2015 1 commit
  15. 28 Apr, 2015 1 commit
    • antirez's avatar
      Fix memory leak in async spontaneous reply handling · 2fc39eb4
      antirez authored
      When an asynchronous hiredis connection subscribes to a Pub/Sub channel
      and gets an error, and in other related conditions, the function
      redisProcessCallbacks() enters a code path where the link is
      disconnected, however the function returns before freeing the allocated
      reply object. This causes a memory leak. The memory leak was trivial to
      trigger in Redis Sentinel, which uses hiredis, every time we tried to
      subscribe to an instance that required a password, in case the Sentinel
      was configured either with the wrong password or without password at
      all. In this case, the -AUTH error caused the leaking code path to be
      executed.
      2fc39eb4
  16. 05 Jan, 2015 6 commits
    • Matt Stancliff's avatar
      Fix redisAppendCommand error result · 6a00a464
      Matt Stancliff authored
      Previously, redisvAppendCommand() would return OOM even with formatting
      errors.  Now we use OTHER with an error string telling the user the
      error was formatting related, not memory related.
      
      This also fixes a potentially worse bug where were would pass error result
      of -1 as an actual length to another function taking an unsigned length,
      which would result in crash/overallocation/errors.  Now for that case,
      we just return an error immediately and stop processing the command.
      
      Fixes #177
      6a00a464
    • Matt Stancliff's avatar
      Fix clang analyzer warning · 9b83ddc2
      Matt Stancliff authored
      redisAsyncInitialize() can return NULL, but then we pass
      the return value from redisAsyncInitialize() into something
      dereferencing the return value, which can cause crashies.
      9b83ddc2
    • mike's avatar
      Add support for SO_REUSEADDR · 7c4d2557
      mike authored
      [This introduces some new API functions.]
      
      * Adds new flag to the connection context indicating SO_REUSEADDR
        should be set.
      * Adds max number of retries constant for when connect() hits
        EADDRNOTAVAIL.
      * Adds new function, redisAsyncConnectBindWithReuse(), letting
        clients enable this functionality.
      
      [Removed trailing whitespace in new header lines.]
      
      Closes #264
      7c4d2557
    • michael-grunder's avatar
      Improve redisAppendCommandArgv performance · 40f7035b
      michael-grunder authored
      OK, perhaps the second time is a charm.  I forgot that I had
      hiredis forked from a long time ago, so the initial pull
      request was hosed.  :)
      
      * Pulled in sdscatfmt() from Redis, and modified it to accept a
        size_t (%T) style format specifier.
      
      * Pulled in sdsll2str() and sdsull2str() from Redis (needed by
        sdscatfmt).
      
      * Added a new method, redisFormatSdsCommandArgv() which takes
        and sds* as the target, rather than char* (and uses sdscatfmt
        instead of sprintf for the construction).
      
      I get roughly the following improvement:
      
      Old: 1.044806
      New: 0.481620
      
      The benchmark code itself can be found here:
      https://gist.github.com/michael-grunder/c92ef31bb632b3d0ad81
      
      Closes #260
      40f7035b
    • Hang Su's avatar
      Use stricter function argument types · 3315c098
      Hang Su authored
      'const' where we can.
      
      Closes #268
      3315c098
    • Jan-Erik Rediger's avatar
      Free string if it is unused · 2a6dbdd2
      Jan-Erik Rediger authored
      If the string is already in the dict, we need to free this.
      
      Original fix by @tt33415366.
      
      Fixes #256
      Closes #286
      2a6dbdd2
  17. 10 Apr, 2014 1 commit
  18. 08 Apr, 2014 3 commits
    • Matt Stancliff's avatar
      Add ability to bind source address on connect · 37d25a39
      Matt Stancliff authored
      Some environments require binding to specific source addresses instead
      of letting the system determine which IP a connection should originate
      from.
      
      Closes #233
      37d25a39
    • Matt Stancliff's avatar
      Fix potential undefined struct read · 61eeedbe
      Matt Stancliff authored
      All the assignments to cb are inside conditionals, so it's
      vaguely possible it never gets initialized before we try
      to read from it with (cb.fn == NULL).
      
      Condition discovered with scan-build.
      
      Closes #229
      61eeedbe
    • Matt Stancliff's avatar
      Remove possiblity of multiple close on same fd · 7f0c7a29
      Matt Stancliff authored
      With all the async connects and disconnects and error handling
      going on in hiredis, we need to centralize how we close our fd
      and set it so it doesn't get re-closed.  Prior to this commit,
      sometimes we'd close(fd), run an async error handler, then
      call close(fd) again.
      
      To stop multiple closes, we now set fd to -1 after we free it,
      but that requires not passing fd as an independent argument to
      functions.
      
      This commit moves all fd usage to c->fd.  Since the context
      has a fd field and all functions receive the context, it makes
      more sense to use the fd inside of c instead of passing along fd
      as an independent argument.
      
      Also, by only using c->fd, we can set c->fd after we close it to
      signify we shouldn't re-close the same fd again.
      
      This does change one semi-public interface function redisCheckSocketError()
      to only take (context) instead of (context, fd).  A search on github
      returned zero occasions of people using redisCheckSocketError()
      outside of net.{c,h} in hiredis itself.
      
      Commit inspired by the bug report at:
      https://groups.google.com/forum/#!topic/redis-db/mQm46XkIPOY
      
      Thanks go out to Thijs for trying high-frequency reconnects on
      a host that isn't there.
      
      Closes #230
      7f0c7a29
  19. 15 Jan, 2014 1 commit
  20. 11 Jul, 2013 1 commit
  21. 22 Jan, 2013 2 commits
  22. 12 Nov, 2012 1 commit
  23. 01 Aug, 2012 1 commit
  24. 11 Jul, 2012 1 commit
  25. 11 Jul, 2011 1 commit
  26. 27 Jun, 2011 1 commit
    • Pieter Noordhuis's avatar
      Change prototype of connect callback · 3313bcd1
      Pieter Noordhuis authored
      This commit adds a status argument to the connect callback. It will be
      called in the event of an unsuccessful connection as well, where the
      status argument is set to REDIS_ERR. It is set to REDIS_OK otherwise.
      3313bcd1