commit 433eb4d47af050ec306ef0bf47924c1d44cb5ed0 from: Stefan Sperling date: Fri Jun 22 07:34:00 2018 UTC make data output param of got_object_idset_remove_random() optional commit - e7c810ea16f3db987ef7ccad3a5c333e32a403a9 commit + 433eb4d47af050ec306ef0bf47924c1d44cb5ed0 blob - cce68c193f06726365ec70d03d254c03f16f8c9a blob + 3b924d503aede627cb96558faf3c86dda69ee5bf --- lib/object_idset.c +++ lib/object_idset.c @@ -190,7 +190,8 @@ got_object_idset_remove_random(void **data, struct got struct got_object_idset_element *entry, *tmp; int i, n; - *data = NULL; + if (data) + *data = NULL; if (set->nelem == 0) return got_error(GOT_ERR_NO_OBJ); @@ -200,7 +201,8 @@ got_object_idset_remove_random(void **data, struct got TAILQ_FOREACH_SAFE(entry, &set->entries[i], entry, tmp) { if (--n == 0) { TAILQ_REMOVE(&set->entries[i], entry, entry); - *data = entry->data; + if (data) + *data = entry->data; free(entry); set->nelem--; return NULL;