- fix memory leak when re-reading config file

- better logging for X errors
pull/68/head
John Tsiombikas 2022-03-27 13:15:59 +03:00
rodzic 0f1f40f38e
commit 9020967ddb
4 zmienionych plików z 23 dodań i 13 usunięć

18
AUTHORS
Wyświetl plik

@ -1,12 +1,20 @@
Main author and maintainer:
John Tsiombikas <nuclear@member.fsf.org>
Serial device support (libsball):
John E. Stone <j.stone@acm.org>
Contributors:
Doug LaRue, Krister Svanlun, Hans Meine, Jaroslaw Bulat, Pavel Frolov,
Robert Haschke, David Lister
Doug LaRue
Krister Svanlun
Hans Meine
Jaroslaw Bulat
Pavel Frolov,
Robert Haschke
David Lister
Stephen Hurd
Gaël Écorchard
Alberto Fanjul
Serial device support in early versions (before the v0.8 rewrite):
John E. Stone <j.stone@acm.org>
NOTE: This file has been left untended for quite a while. There are bound to be
contributions from people not listed here. If you ever contributed code to this

Wyświetl plik

@ -153,6 +153,7 @@ int read_cfg(const char *fname, struct cfg *cfg)
if(!num_lines) num_lines = 1;
/* add enough lines to be able to append any number of new options */
free(cfglines);
if(!(cfglines = calloc(num_lines + NUM_EXTRA_LINES, sizeof *cfglines))) {
logmsg(LOG_WARNING, "failed to allocate config lines buffer (%d lines)\n", num_lines);
unlock_cfgfile(fd);

Wyświetl plik

@ -118,9 +118,9 @@ void init_devices_serial(void)
strcpy(dev->path, cfg.serial_dev);
if(open_dev_serial(dev) == -1) {
remove_device(dev);
} else {
logmsg(LOG_INFO, "using device: %s\n", cfg.serial_dev);
return;
}
logmsg(LOG_INFO, "using device: %s\n", cfg.serial_dev);
/* new serial device added, send device change event */
ev.dev.type = EVENT_DEV;

Wyświetl plik

@ -224,7 +224,7 @@ int get_x11_socket(void)
void send_xevent(spnav_event *ev, struct client *c)
{
int i;
XEvent xevent;
XEvent xevent = {0};
if(!dpy) return;
@ -396,18 +396,19 @@ static int xerr(Display *dpy, XErrorEvent *err)
{
char buf[512];
if(verbose) {
logmsg(LOG_ERR, "xerr(%p, %p)\n", (void*)dpy, (void*)err);
}
if(err->error_code == BadWindow) {
if(verbose) {
logmsg(LOG_INFO, "Caught BadWindow, dropping client with window: %x\n",
(unsigned int)err->resourceid);
}
/* we may get a BadWindow error when trying to send events to
* clients that have disconnected in the meanwhile.
*/
remove_client_window((Window)err->resourceid);
} else {
XGetErrorText(dpy, err->error_code, buf, sizeof buf);
logmsg(LOG_ERR, "Caught unexpected X error: %s\n", buf);
logmsg(LOG_ERR, "Caught unexpected X error: %s [op: %d,%d, res: %u]\n", buf,
(int)err->request_code, (int)err->minor_code, (unsigned int)err->resourceid);
}
return 0;
}