Fix int_array_concat() to bail out on realloc failure
The previous version could have ended up dereferencing a NULL pointer if the reallocation call were to fail.
This commit is contained in:
parent
72ffc08242
commit
e6c0ebff68
1 changed files with 1 additions and 0 deletions
|
@ -132,6 +132,7 @@ static void int_array_concat(int **res, const int *a)
|
||||||
if (n == NULL) {
|
if (n == NULL) {
|
||||||
os_free(*res);
|
os_free(*res);
|
||||||
*res = NULL;
|
*res = NULL;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
for (i = 0; i <= alen; i++)
|
for (i = 0; i <= alen; i++)
|
||||||
n[reslen + i] = a[i];
|
n[reslen + i] = a[i];
|
||||||
|
|
Loading…
Reference in a new issue