Browse Source

fix a possible free of a uninitialize variable in paste()

master
Hiltjo Posthuma 7 years ago
parent
commit
1cabeda550
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      dmenu.c

+ 6
- 4
dmenu.c View File

@ -467,10 +467,12 @@ paste(void)
Atom da;
/* we have been given the current selection, now insert it into input */
XGetWindowProperty(dpy, win, utf8, 0, (sizeof text / 4) + 1, False,
utf8, &da, &di, &dl, &dl, (unsigned char **)&p);
insert(p, (q = strchr(p, '\n')) ? q - p : (ssize_t)strlen(p));
XFree(p);
if (XGetWindowProperty(dpy, win, utf8, 0, (sizeof text / 4) + 1, False,
utf8, &da, &di, &dl, &dl, (unsigned char **)&p)
== Success && p) {
insert(p, (q = strchr(p, '\n')) ? q - p : (ssize_t)strlen(p));
XFree(p);
}
drawmenu();
}


Loading…
Cancel
Save