[hackers] [st] clipcopy: no need to check for free(NULL), set to NULL after free || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Sat, 17 Mar 2018 13:48:53 +0100 (CET)

commit 5345db3c9be1a22ca19202035b881b951c2f0f9e
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Sat Mar 17 13:48:10 2018 +0100
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Sat Mar 17 13:48:10 2018 +0100

    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
_AT_@ -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);
Received on Sat Mar 17 2018 - 13:48:53 CET

This archive was generated by hypermail 2.3.0 : Sat Mar 17 2018 - 14:00:29 CET