Christian Kellner 4b59818fd4 common: add autofree helper
Much like the auto-closing helper for file descriptors, add a new
auto-free helper that is meant to be used with dynamically allocated
memory, a la:
  autofree char *data = NULL;
  ...
  data = malloc(size);
When data goes out of scope, cleanup_free will be called with &data,
i.e. cleanup_free(&data), which in turn will call free(3) data. In
order to work with all types, e.g. 'char *' (resulting in char **
being passed to cleanup_free) or 'int *' (resulting in int ** being
passed to cleanup_free), cleanup_free is defined to work with void *,
hence the odd-looking cast: void *target = *(void **) ptr.
2019-10-18 13:19:30 +02:00
..
2019-06-01 10:57:27 +01:00
2019-06-01 10:57:27 +01:00
2019-08-05 09:50:32 +00:00
2019-06-01 11:12:10 +01:00
2019-10-18 13:19:30 +02:00
2019-10-18 13:19:30 +02:00
2019-06-01 10:57:27 +01:00