struct rspamd_worker *worker = (struct rspamd_worker *)w->data;
struct rspamd_controller_worker_ctx *ctx;
struct rspamd_controller_session *session;
- rspamd_inet_addr_t *addr;
+ rspamd_inet_addr_t *addr = NULL;
gint nfd;
ctx = worker->ctx;
}
/* Check for EAGAIN */
if (nfd == 0) {
+ rspamd_inet_address_free (addr);
return;
}
struct rspamd_cryptobox_keypair *decrypt_keypair = NULL;
gchar *data;
- if (stat (filename, &st) == -1) {
- g_set_error (err, cfg_rcl_error_quark (), errno,
- "cannot stat %s: %s", filename, strerror (errno));
- return FALSE;
- }
if ((fd = open (filename, O_RDONLY)) == -1) {
g_set_error (err, cfg_rcl_error_quark (), errno,
"cannot open %s: %s", filename, strerror (errno));
return FALSE;
}
+ if (fstat (fd, &st) == -1) {
+ g_set_error (err, cfg_rcl_error_quark (), errno,
+ "cannot stat %s: %s", filename, strerror (errno));
+ close (fd);
+
+ return FALSE;
+ }
/* Now mmap this file to simplify reading process */
if ((data = mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) {
g_set_error (err, cfg_rcl_error_quark (), errno,
"cannot mmap %s: %s", filename, strerror (errno));
close (fd);
+
return FALSE;
}
/* Try to load keyfile if available */
rspamd_snprintf (keypair_path, sizeof (keypair_path), "%s.key",
filename);
- if (stat (keypair_path, &st) == -1 &&
- (fd = open (keypair_path, O_RDONLY)) != -1) {
+ if ((fd = open (keypair_path, O_RDONLY)) != -1) {
struct ucl_parser *kp_parser;
kp_parser = ucl_parser_new (0);
}
ucl_parser_free (kp_parser);
+ close (fd);
}
parser = ucl_parser_new (UCL_PARSER_SAVE_COMMENTS);
cur = found;
}
}
+
+ g_strfreev (path_components);
}
return rspamd_rcl_add_doc_obj (ucl_object_ref (cur),
if (lseek (fd, off, SEEK_SET) == -1) {
msg_err_map ("can't seek in map to pos %d for buffered reading %s: %s",
(gint)off, fname, strerror (errno));
+ close (fd);
+
return FALSE;
}
cdb = g_malloc0 (sizeof (struct cdb));
if (cdb_init (cdb, fd) == -1) {
+ g_free (cdb);
msg_err_map ("cannot init cdb map from %s: %s", chunk, strerror (errno));
return NULL;
if (target) {
*target = res;
}
+ else {
+ ucl_object_unref (res);
+ }
return RSPAMD_STAT_PROCESS_OK;
}
}
if (ev_base == NULL) {
+ g_free (auth);
+ rspamd_http_message_unref (msg);
+ if (body) {
+ rspamd_fstring_free (body);
+ }
+
return luaL_error (L,
"Bad params to rspamd_http:request(): ev_base isn't passed");
}
signature->str, (guint *)&signature->len, rsa);
if (ret != 1) {
+ rspamd_fstring_free (signature);
+
return luaL_error (L, "cannot sign: %s",
ERR_error_string (ERR_get_error (), NULL));
}
struct rspamd_lua_regexp *re;
gboolean stringify = FALSE, own_re = FALSE;
+ if (t == NULL) {
+ return luaL_error (L, "invalid arguments");
+ }
+
if (lua_type (L, 2) == LUA_TUSERDATA) {
re = lua_check_regexp (L, 2);
}
own_re = TRUE;
}
- if (t && re) {
+ if (re) {
if (lua_isboolean (L, 3)) {
stringify = lua_toboolean (L, 3);
}
}
else {
msg_info ("bad url protocol: %s", *cvec);
+ g_strfreev (strvec);
+
return FALSE;
}
{
struct rspamadm_lua_repl_context *ctx =
(struct rspamadm_lua_repl_context *)w->data;
- rspamd_inet_addr_t *addr;
+ rspamd_inet_addr_t *addr = NULL;
struct rspamadm_lua_repl_session *session;
gint nfd;
}
/* Check for EAGAIN */
if (nfd == 0) {
+ rspamd_inet_address_free (addr);
return;
}
rspamd_control_handler (EV_P_ ev_io *w, int revents)
{
struct rspamd_main *rspamd_main = (struct rspamd_main *)w->data;
- rspamd_inet_addr_t *addr;
+ rspamd_inet_addr_t *addr = NULL;
gint nfd;
if ((nfd =
}
/* Check for EAGAIN */
if (nfd == 0) {
+ rspamd_inet_address_free (addr);
return;
}
{
struct rspamd_worker *worker = (struct rspamd_worker *)w->data;
struct rspamd_proxy_ctx *ctx;
- rspamd_inet_addr_t *addr;
+ rspamd_inet_addr_t *addr = NULL;
struct rspamd_proxy_session *session;
gint nfd;
}
/* Check for EAGAIN */
if (nfd == 0) {
+ rspamd_inet_address_free (addr);
return;
}
struct rspamd_worker *worker = (struct rspamd_worker *) w->data;
struct rspamd_worker_ctx *ctx;
struct rspamd_worker_session *session;
- rspamd_inet_addr_t *addr;
+ rspamd_inet_addr_t *addr = NULL;
gint nfd, http_opts = 0;
ctx = worker->ctx;
}
/* Check for EAGAIN */
if (nfd == 0) {
+ rspamd_inet_address_free (addr);
+
return;
}
rspamd_server_accept (gint fd, short what, void *arg)
{
struct rspamd_http_connection_router *rt = arg;
- rspamd_inet_addr_t *addr;
+ rspamd_inet_addr_t *addr = NULL;
gint nfd;
if ((nfd =
}
/* Check for EAGAIN */
if (nfd == 0) {
+ rspamd_inet_address_free (addr);
return;
}
}
/* Check for EAGAIN */
if (nfd == 0) {
+ rspamd_inet_address_free (addr);
return;
}