From e67028f4bc5fed69b70238b1dff74f9a7d2eda1b Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Mon, 21 Jan 2019 01:32:53 +0000 Subject: [PATCH] Handle failed allocation in list adaptation --- psycopg/adapter_list.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/psycopg/adapter_list.c b/psycopg/adapter_list.c index 5c6fa693..889c5f84 100644 --- a/psycopg/adapter_list.c +++ b/psycopg/adapter_list.c @@ -90,7 +90,9 @@ list_quote(listObject *self) * array[array[]] is */ all_nulls = 0; Py_CLEAR(qs[i]); - qs[i] = Bytes_FromString("ARRAY[]"); + if (!(qs[i] = Bytes_FromString("ARRAY[]"))) { + goto exit; + } } } else {