Re: Error in recent pg_dump change (coverity)
От | Tom Lane |
---|---|
Тема | Re: Error in recent pg_dump change (coverity) |
Дата | |
Msg-id | 17688.1148832033@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Error in recent pg_dump change (coverity) (Alvaro Herrera <alvherre@commandprompt.com>) |
Ответы |
Re: Error in recent pg_dump change (coverity)
|
Список | pgsql-hackers |
Alvaro Herrera <alvherre@commandprompt.com> writes: > Martijn van Oosterhout wrote: >> I'd actually suggest zeroing out res->tuples in PQclear so this sort of >> problem becomes much more obvious. > Is it worthwhile to zero out the res->block array as well? Your patch isn't doing that, merely zeroing a local variable that will be assigned to in a moment anyway. That loop already ensures that res->curBlock is null when it exits. So lose this: + block = NULL; This part seems OK: /* Free the top-level tuple pointer array */ if (res->tuples) + { free(res->tuples); + res->tuples = NULL; + } Another possibility is to just MemSet the whole PGresult struct to zeroes before free'ing it. Compared to the cost of obtaining a query result from the backend, this probably doesn't cost enough to be worth worrying about, and it would catch a few more problems of the same ilk. regards, tom lane
В списке pgsql-hackers по дате отправления: