fixed a typo in config.mk, fixed cleanup code in dmenu (now frees all allocated stuff)
bbb2cc2a
2 file(s) · +16 −5
| 11 | 11 | X11LIB = /usr/X11R6/lib |
|
| 12 | 12 | ||
| 13 | 13 | # includes and libs |
|
| 14 | - | INCS = _I. -I/usr/include -I${X11INC} |
|
| 14 | + | INCS = -I. -I/usr/include -I${X11INC} |
|
| 15 | 15 | LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 |
|
| 16 | 16 | ||
| 17 | 17 | # flags |
| 29 | 29 | static int ret = 0; |
|
| 30 | 30 | static int nitem = 0; |
|
| 31 | 31 | static unsigned int cmdw = 0; |
|
| 32 | - | static Bool done = False; |
|
| 32 | + | static Bool running = True; |
|
| 33 | 33 | static Item *allitems = NULL; /* first of all items */ |
|
| 34 | 34 | static Item *item = NULL; /* first of pattern matching items */ |
|
| 35 | 35 | static Item *sel = NULL; |
|
| 219 | 219 | else if(text) |
|
| 220 | 220 | fprintf(stdout, "%s", text); |
|
| 221 | 221 | fflush(stdout); |
|
| 222 | - | done = True; |
|
| 222 | + | running = False; |
|
| 223 | 223 | break; |
|
| 224 | 224 | case XK_Escape: |
|
| 225 | 225 | ret = 1; |
|
| 226 | - | done = True; |
|
| 226 | + | running = False; |
|
| 227 | 227 | break; |
|
| 228 | 228 | case XK_BackSpace: |
|
| 229 | 229 | if((i = len)) { |
|
| 290 | 290 | main(int argc, char *argv[]) |
|
| 291 | 291 | { |
|
| 292 | 292 | char *maxname; |
|
| 293 | + | Item *i; |
|
| 293 | 294 | XEvent ev; |
|
| 294 | 295 | XSetWindowAttributes wa; |
|
| 295 | 296 | ||
| 349 | 350 | XSync(dpy, False); |
|
| 350 | 351 | ||
| 351 | 352 | /* main event loop */ |
|
| 352 | - | while(!done && !XNextEvent(dpy, &ev)) { |
|
| 353 | + | while(running && !XNextEvent(dpy, &ev)) { |
|
| 353 | 354 | switch (ev.type) { |
|
| 354 | 355 | case KeyPress: |
|
| 355 | 356 | kpress(&ev.xkey); |
|
| 364 | 365 | } |
|
| 365 | 366 | ||
| 366 | 367 | XUngrabKeyboard(dpy, CurrentTime); |
|
| 368 | + | while(allitems) { |
|
| 369 | + | i = allitems->next; |
|
| 370 | + | free(allitems->text); |
|
| 371 | + | free(allitems); |
|
| 372 | + | allitems = i; |
|
| 373 | + | } |
|
| 374 | + | if(dc.font.set) |
|
| 375 | + | XFreeFontSet(dpy, dc.font.set); |
|
| 376 | + | else |
|
| 377 | + | XFreeFont(dpy, dc.font.xfont); |
|
| 367 | 378 | XFreePixmap(dpy, dc.drawable); |
|
| 368 | 379 | XFreeGC(dpy, dc.gc); |
|
| 369 | 380 | XDestroyWindow(dpy, win); |
|