free() in free_acquired() causes SIGSEGV
The libprocps4 package in Ubuntu 16.04 is built with WITH_SYSTEMD defined. This enables additional fields in the proc_t struct (prefixed with sd_). However, WITH_SYSTEMD is not defined anywhere in /usr/include/proc/*.h. This means that in Ubuntu 16.04 a caller and the library use different proc_t layout. Consider the following code:
#include <proc/readproc.h>
PROCTAB* procTab = openproc(PROC_FILLSTAT|PROC_FILLMEM|PROC_UID);
proc_t buff;
bzero(&buff, sizeof(buff));
readproc(procTab, &buff)
bzero() does not clear the sd_* fields as it doesn't know about them. readproc() calls free_acquired() which frees the sd_* fields if they are non-zero. This causes undefined behavior (SIGSEGV in my case) as free() is called with a random value.