static int read_flag(const char *varname) {
int r;
- void *v;
+ _cleanup_free_ void *v = NULL;
size_t s;
uint8_t b;
if (r < 0)
return r;
- if (s != 1) {
- r = -EINVAL;
- goto finish;
- }
+ if (s != 1)
+ return -EINVAL;
b = *(uint8_t *)v;
r = b > 0;
-finish:
- free(v);
return r;
}
list[count ++] = id;
}
- if (list)
- qsort(list, count, sizeof(uint16_t), cmp_uint16);
+ qsort_safe(list, count, sizeof(uint16_t), cmp_uint16);
*options = list;
return count;