Browse Source

* fix segfault in redis backend

master
Alex 'AdUser' Z 8 years ago
parent
commit
c07a8d0b86
  1. 6
      src/backends/redis.c

6
src/backends/redis.c

@ -50,11 +50,11 @@ redis_connect(cfg_t *cfg) {
if (!conn)
break;
if (conn->err) {
snprintf(cfg->error, sizeof(cfg->error), "Connection error: %s", cfg->conn->errstr);
snprintf(cfg->error, sizeof(cfg->error), "Connection error: %s", conn->errstr);
break;
}
if (cfg->password[0]) {
reply = redisCommand(cfg->conn, "AUTH %s", cfg->password);
reply = redisCommand(conn, "AUTH %s", cfg->password);
if (reply->type == REDIS_REPLY_ERROR) {
snprintf(cfg->error, sizeof(cfg->error), "auth error: %s", reply->str);
break;
@ -62,7 +62,7 @@ redis_connect(cfg_t *cfg) {
freeReplyObject(reply);
}
if (cfg->database) {
reply = redisCommand(cfg->conn, "SELECT %d", cfg->database);
reply = redisCommand(conn, "SELECT %d", cfg->database);
if (reply->type == REDIS_REPLY_ERROR) {
snprintf(cfg->error, sizeof(cfg->error), "auth error: %s", reply->str);
break;

Loading…
Cancel
Save