Well, the solution was as simple as this: bool dns_register_smbd_reply(struct dns_reg_state *dns_state, fd_set *lfds, struct timeval *timeout) { int mdnsd_conn_fd = -1; + if (!dns_state) return false; if (dns_state->srv_ref == NULL) { return false; }