Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x
От | Michael Paquier |
---|---|
Тема | Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x |
Дата | |
Msg-id | CAB7nPqRdAjUB9pTL3LRSQ33dr4qv-rvHduj2DJxibSVA0owTTA@mail.gmail.com обсуждение исходный текст |
Ответ на | Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x (Bill Parker <wp02855@gmail.com>) |
Ответы |
Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL
9.4.x
|
Список | pgsql-bugs |
(Adding Michael Meskes in CC:) On Fri, Jun 12, 2015 at 4:11 AM, Bill Parker <wp02855@gmail.com> wrote: > --- misc.c.orig 2015-06-11 09:23:13.807020490 -0700 > +++ misc.c 2015-06-11 09:32:10.077177669 -0700 > @@ -143,6 +143,9 @@ > if (sqlca == NULL) > { > sqlca = malloc(sizeof(struct sqlca_t)); > + if (sqlca == NULL) { /* malloc() failed, now what should > we do? */ > + ecpg_log("Unable to allocate memory in > ECPGget_sqlca()\n"); > + } > ecpg_init_sqlca(sqlca); > pthread_setspecific(sqlca_key, sqlca); > } > > Please feel free to review and comment on the above patch file... > > I am attaching the patch file to this bug report > > Bill Parker (wp02855 at gmail dot com) Nice catch. Regarding your patch, it seems to me that this is not enough. I think that we should return NULL with ECPGget_sqlca in case of an OOM instead of logging a message with ecpg_log and let each code path decide what to do when sqlca is NULL. Some code paths can directly use ecpg_raise with ECPG_OUT_OF_MEMORY. Other code paths, like the ones in error.c will need to show up with appropriate error messages. -- Michael
В списке pgsql-bugs по дате отправления: