[hackers] [st][PATCH] adds tmux primary clipboard support, fixed memory leak, added attribution

From: fpqc ?? <harry.gindi_AT_live.com>
Date: Wed, 18 Jan 2017 15:52:57 +0000

---
 base64dec.c | 5 +++--
 st.c        | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/base64dec.c b/base64dec.c
index 71639af..335e3c5 100644
--- a/base64dec.c
+++ b/base64dec.c
_AT_@ -1,12 +1,13 @@
+/*taken from libulz with permission*/
 
-const char base64_tbl[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char base64_tbl[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 static inline int chrpos(int c) {
 	int i = 0;
 	for(;i<64;i++) if(base64_tbl[i] == c) return i;
 	return -1;
 }
-size_t base64dec(void* dst, const char* src, size_t dst_len) {
+static size_t base64dec(void* dst, const char* src, size_t dst_len) {
 	const char* s = src;
 	unsigned char *d = dst;
 	size_t l = dst_len, o = 0;
diff --git a/st.c b/st.c
index ea03e73..158521e 100644
--- a/st.c
+++ b/st.c
_AT_@ -2546,6 +2546,7 @@ strhandle(void)
 				base64dec(buf, src, l);
 				printf(buf);
 				xsetsel(buf, CurrentTime);
+				free(buf);
 			}
 		case 104: /* color reset, here p = NULL */
 			j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
-- 
2.11.0
Received on Wed Jan 18 2017 - 16:52:57 CET

This archive was generated by hypermail 2.3.0 : Wed Jan 18 2017 - 17:00:19 CET