check for failure on realloc
This commit is contained in:
parent
b9b6d60aff
commit
2d6303e311
@ -30,6 +30,10 @@ static CleanArray clean;
|
|||||||
*/
|
*/
|
||||||
void add_to_cleanup(void *data) {
|
void add_to_cleanup(void *data) {
|
||||||
clean.array = realloc(clean.array, (clean.size + 1) * sizeof(void *));
|
clean.array = realloc(clean.array, (clean.size + 1) * sizeof(void *));
|
||||||
|
if (clean.array == NULL) {
|
||||||
|
perror("realloc");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
clean.array[clean.size++] = data;
|
clean.array[clean.size++] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user