aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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