/* First of all check digest */
session->nargs = nargs;
- session->argv = g_malloc (sizeof (gchar *) * session->nargs);
- session->argv_lens = g_malloc (sizeof (gsize) * session->nargs);
+ session->argv = g_malloc0 (sizeof (gchar *) * session->nargs);
+ session->argv_lens = g_malloc0 (sizeof (gsize) * session->nargs);
up = rspamd_upstream_get (backend->write_servers,
RSPAMD_UPSTREAM_MASTER_SLAVE,
}
- g_list_free (conn->entry);
+ if (conn->entry) {
+ g_list_free (conn->entry);
+ }
+
g_slice_free1 (sizeof (*conn), conn);
}
conn_entry = g_queue_pop_head_link (elt->inactive);
conn = conn_entry->data;
- if (event_get_base (&conn->timeout)) {
- event_del (&conn->timeout);
- }
-
if (conn->ctx->err == REDIS_OK) {
+ if (event_get_base (&conn->timeout)) {
+ event_del (&conn->timeout);
+ }
+
conn->active = TRUE;
g_queue_push_tail_link (elt->active, conn_entry);
msg_debug_rpool ("reused existing connection to %s:%d", ip, port);
}
else {
+ g_list_free (conn->entry);
+ conn->entry = NULL;
REF_RELEASE (conn);
conn = rspamd_redis_pool_new_connection (pool, elt,
db, password, ip, port);