DNPRINTF(SWM_D_MISC, "find_pid: %lu\n", pid);
+ if (pid == 0)
+ return (NULL);
+
TAILQ_FOREACH(p, &pidlist, entry) {
if (p->pid == pid)
return (p);
int actual_format_return = 0;
unsigned long nitems_return = 0;
unsigned long bytes_after_return = 0;
- long *pid = 0;
+ long *pid = NULL;
long ret = 0;
if (XGetWindowProperty(display, win,
&nitems_return, &bytes_after_return,
(unsigned char**)(void*)&pid) != Success)
return (0);
+ if (actual_type_return != XA_CARDINAL)
+ return (0);
+ if (pid == NULL)
+ return (0);
- ret = pid[0];
+ ret = *pid;
XFree(pid);
return (ret);