From ed8cfba46d8da7c4e0ffc899770c8b5d6be62b10 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan.bosch@open-xchange.com> Date: Tue, 22 Oct 2019 22:28:08 +0200 Subject: [PATCH] lib-sieve: sieve-script - sieve_script_unref(NULL) should be a no-op. --- src/lib-sieve/sieve-script.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib-sieve/sieve-script.c b/src/lib-sieve/sieve-script.c index d99d01cd6..822d6ddab 100644 --- a/src/lib-sieve/sieve-script.c +++ b/src/lib-sieve/sieve-script.c @@ -139,8 +139,12 @@ void sieve_script_unref(struct sieve_script **_script) { struct sieve_script *script = *_script; - i_assert(script->refcount > 0); + *_script = NULL; + if (script == NULL) + return; + + i_assert(script->refcount > 0); if (--script->refcount != 0) return; @@ -152,7 +156,6 @@ void sieve_script_unref(struct sieve_script **_script) sieve_storage_unref(&script->storage); event_unref(&script->event); pool_unref(&script->pool); - *_script = NULL; } int sieve_script_open(struct sieve_script *script, enum sieve_error *error_r) -- GitLab