diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-13 15:01:18 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-13 15:01:55 +0000 |
commit | f7aee39a9dc81ae437e1dcc651a7335a7ae071d3 (patch) | |
tree | 491a5422b5e32feabad05fca0cdb9ae196f731a5 /src/libutil/rrd.c | |
parent | 376b5cac00888b7d3203f2c3e5611b0d25044c6b (diff) | |
download | rspamd-f7aee39a9dc81ae437e1dcc651a7335a7ae071d3.tar.gz rspamd-f7aee39a9dc81ae437e1dcc651a7335a7ae071d3.zip |
[Fix] Fix various issues found by PVS Studio
https://www.viva64.com/
Diffstat (limited to 'src/libutil/rrd.c')
-rw-r--r-- | src/libutil/rrd.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/libutil/rrd.c b/src/libutil/rrd.c index 95d78c7f5..d17e823e6 100644 --- a/src/libutil/rrd.c +++ b/src/libutil/rrd.c @@ -228,12 +228,6 @@ rspamd_rrd_check_file (const gchar *filename, gboolean need_data, GError **err) close (fd); return FALSE; } - if (memcmp (head.version, RRD_VERSION, sizeof (head.version)) != 0) { - g_set_error (err, - rrd_error_quark (), EINVAL, "rrd head error: invalid version"); - close (fd); - return FALSE; - } if (head.float_cookie != RRD_FLOAT_COOKIE) { g_set_error (err, rrd_error_quark (), EINVAL, "rrd head error: another architecture " @@ -409,16 +403,12 @@ rspamd_rrd_open_common (const gchar *filename, gboolean completed, GError **err) file = g_malloc0 (sizeof (struct rspamd_rrd_file)); - if (file == NULL) { - g_set_error (err, rrd_error_quark (), ENOMEM, "not enough memory"); - return NULL; - } - /* Open file */ fd = rspamd_rrd_open_exclusive (filename); if (fd == -1) { g_set_error (err, rrd_error_quark (), errno, "rrd open error: %s", strerror (errno)); + g_free (file); return FALSE; } @@ -426,6 +416,7 @@ rspamd_rrd_open_common (const gchar *filename, gboolean completed, GError **err) g_set_error (err, rrd_error_quark (), errno, "rrd stat error: %s", strerror (errno)); rspamd_file_unlock (fd, FALSE); + g_free (file); close (fd); return FALSE; } |