d54e517
diff -up xclip-11cba613840b0d0e76dc2ea6d4ec7cc5f23daf88/xclip.c.1947285 xclip-11cba613840b0d0e76dc2ea6d4ec7cc5f23daf88/xclip.c
d54e517
--- xclip-11cba613840b0d0e76dc2ea6d4ec7cc5f23daf88/xclip.c.1947285	2020-11-08 09:01:39.000000000 -0500
ad8dbaa
+++ xclip-11cba613840b0d0e76dc2ea6d4ec7cc5f23daf88/xclip.c	2022-02-22 18:04:44.598444273 -0500
ad8dbaa
@@ -353,7 +353,7 @@ doOptTarget(void)
ad8dbaa
 static int
ad8dbaa
 doIn(Window win, const char *progname)
ad8dbaa
 {
ad8dbaa
-    unsigned char *sel_buf;	/* buffer for selection data */
ad8dbaa
+    unsigned char *sel_buf = NULL;	/* buffer for selection data */
ad8dbaa
     unsigned long sel_len = 0;	/* length of sel_buf */
ad8dbaa
     unsigned long sel_all = 0;	/* allocated size of sel_buf */
ad8dbaa
     XEvent evt;			/* X Event Structures */
d54e517
@@ -714,9 +714,9 @@ static int
d54e517
 doOut(Window win)
d54e517
 {
d54e517
     Atom sel_type = None;
d54e517
-    unsigned char *sel_buf;	/* buffer for selection data */
d54e517
-    unsigned long sel_len = 0;	/* length of sel_buf */
d54e517
-    XEvent evt;			/* X Event Structures */
d54e517
+    unsigned char *sel_buf = NULL;	/* buffer for selection data */
d54e517
+    unsigned long sel_len = 0;		/* length of sel_buf */
d54e517
+    XEvent evt;				/* X Event Structures */
d54e517
     unsigned int context = XCLIB_XCOUT_NONE;
d54e517
 
d54e517
     if (sseln == XA_STRING)
d54e517
@@ -743,9 +743,11 @@ doOut(Window win)
d54e517
 			/* If user requested -sensitive, then prevent further pastes (even though we failed to paste) */
d54e517
 			XSetSelectionOwner(dpy, sseln, None, CurrentTime);
d54e517
 			/* Clear memory buffer */
d54e517
-			xcmemzero(sel_buf,sel_len);
d54e517
+			if (sel_buf != NULL)
d54e517
+			    xcmemzero(sel_buf,sel_len);
d54e517
 		    }
d54e517
-		    free(sel_buf);
d54e517
+		    if (sel_buf != NULL)
d54e517
+			free(sel_buf);
d54e517
 		    errconvsel(dpy, target, sseln);
d54e517
 		    // errconvsel does not return but exits with EXIT_FAILURE
d54e517
 		}