aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2017-11-03 15:31:37 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2017-11-03 21:07:02 +0100
commit1cabeda5505dcc35d4d2ca2a09151a7c449fb401 (patch)
treead202761d53c00ee527e3acec24180a04d606ff6
parent41379f7c39e6aa0a17d7807b22b49ea148f5b0fa (diff)
fix a possible free of a uninitialize variable in paste()
-rw-r--r--dmenu.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/dmenu.c b/dmenu.c
index 91330f1..eae5685 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -467,10 +467,12 @@ paste(void)
467 Atom da; 467 Atom da;
468 468
469 /* we have been given the current selection, now insert it into input */ 469 /* we have been given the current selection, now insert it into input */
470 XGetWindowProperty(dpy, win, utf8, 0, (sizeof text / 4) + 1, False, 470 if (XGetWindowProperty(dpy, win, utf8, 0, (sizeof text / 4) + 1, False,
471 utf8, &da, &di, &dl, &dl, (unsigned char **)&p); 471 utf8, &da, &di, &dl, &dl, (unsigned char **)&p)
472 insert(p, (q = strchr(p, '\n')) ? q - p : (ssize_t)strlen(p)); 472 == Success && p) {
473 XFree(p); 473 insert(p, (q = strchr(p, '\n')) ? q - p : (ssize_t)strlen(p));
474 XFree(p);
475 }
474 drawmenu(); 476 drawmenu();
475} 477}
476 478