aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-04 15:18:07 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-04 15:18:07 +0100
commitd14083964c313c566d1cd6017a4f622f2ef97ef5 (patch)
tree690455575ec1e3225cbbf1cb7a24d4219057e578 /src
parenta24b1306ff804c375ebca37bde889831afe6455b (diff)
downloadrspamd-d14083964c313c566d1cd6017a4f622f2ef97ef5.tar.gz
rspamd-d14083964c313c566d1cd6017a4f622f2ef97ef5.zip
Check upstream before freeing.
Diffstat (limited to 'src')
-rw-r--r--src/libutil/upstream.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c
index 6aa447042..a0ffd56e1 100644
--- a/src/libutil/upstream.c
+++ b/src/libutil/upstream.c
@@ -518,17 +518,19 @@ rspamd_upstreams_destroy (struct upstream_list *ups)
guint i;
struct upstream *up;
- g_ptr_array_free (ups->alive, TRUE);
+ if (ups != NULL) {
+ g_ptr_array_free (ups->alive, TRUE);
- for (i = 0; i < ups->ups->len; i ++) {
- up = g_ptr_array_index (ups->ups, i);
- up->ls = NULL;
- REF_RELEASE (up);
- }
+ for (i = 0; i < ups->ups->len; i ++) {
+ up = g_ptr_array_index (ups->ups, i);
+ up->ls = NULL;
+ REF_RELEASE (up);
+ }
- g_ptr_array_free (ups->ups, TRUE);
- rspamd_mutex_free (ups->lock);
- g_slice_free1 (sizeof (*ups), ups);
+ g_ptr_array_free (ups->ups, TRUE);
+ rspamd_mutex_free (ups->lock);
+ g_slice_free1 (sizeof (*ups), ups);
+ }
}
static void