From: | Daniel Gustafsson <dgustafsson(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Guard against reallocation failure in pg_regress |
Date: | 2022-02-24 19:59:21 |
Message-ID: | E1nNKGm-000Cmy-7f@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Guard against reallocation failure in pg_regress
realloc() will return NULL on a failed reallocation, so the destination
pointer must be inspected to avoid null pointer dereference. Further,
assigning the return value to the source pointer leak the allocation in
the case of reallocation failure. Fix by using pg_realloc instead which
has full error handling.
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/9FC7E603-9246-4C62-B466-A39CFAF454AE@yesql.se
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/31d8d4740ffb21c9898a21b5018c31e92af6935d
Modified Files
--------------
src/test/regress/pg_regress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2022-02-25 02:31:50 | pgsql: Remove unnecessary heap_tuple_needs_freeze argument. |
Previous Message | Heikki Linnakangas | 2022-02-24 14:32:53 | pgsql: Fix data loss on crash after sorted GiST index build. |