From 5fe30380a23ff21e7e3371836f4873d049a11695 Mon Sep 17 00:00:00 2001
From: Andy Green <andy@warmcat.com>
Date: Wed, 28 Nov 2018 15:07:53 +0800
Subject: [PATCH] lwsac: unreference: allow to be called with NULL

---
 lib/misc/lwsac/lwsac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/misc/lwsac/lwsac.c b/lib/misc/lwsac/lwsac.c
index abde1a83..07e0fa28 100644
--- a/lib/misc/lwsac/lwsac.c
+++ b/lib/misc/lwsac/lwsac.c
@@ -168,6 +168,8 @@ lwsac_reference(struct lwsac *head)
 void
 lwsac_unreference(struct lwsac **head)
 {
+	if (!(*head))
+		return;
 	(*head)->refcount--;
 	if ((*head)->detached && !(*head)->refcount)
 		lwsac_free(head);
-- 
GitLab