From: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 17 Mar 2018 12:48:10 +0000 (+0100)
Subject: clipcopy: no need to check for free(NULL), set to NULL after free
X-Git-Url: https://git.owens.tech/editable-focus.html/editable-focus.html/git?a=commitdiff_plain;h=5345db3c9be1a22ca19202035b881b951c2f0f9e;p=st.git

clipcopy: no need to check for free(NULL), set to NULL after free
---

diff --git a/x.c b/x.c
index d0b26ac..12bc86b 100644
--- a/x.c
+++ b/x.c
@@ -245,8 +245,8 @@ clipcopy(const Arg *dummy)
 {
 	Atom clipboard;
 
-	if (xsel.clipboard != NULL)
-		free(xsel.clipboard);
+	free(xsel.clipboard);
+	xsel.clipboard = NULL;
 
 	if (xsel.primary != NULL) {
 		xsel.clipboard = xstrdup(xsel.primary);