xcap_client: Fix two mem corruptions.

See the two commits:

- in both cases the first item of the linked list is not freed,
- the freed memory is read
- lastly a NULL is freed (or in the second case, a NULL-dereference)