Re: Missing NULL check after calling ecpg_strdup - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: Missing NULL check after calling ecpg_strdup
Date
Msg-id CAJ7c6TNvFTPUTZQuNAoqgzaSGz-iM4XR61D7vEj5PsQXwg2RyA@mail.gmail.com
Whole thread Raw
In response to Missing NULL check after calling ecpg_strdup  (Evgeniy Gorbanev <gorbanyoves@basealt.ru>)
Responses Re: Missing NULL check after calling ecpg_strdup
List pgsql-hackers
Hi Evgeniy,

> In case of out_of_memory, the ecpg_strdup function may return NULL.
> Checks should be added in src/interfaces/ecpg/ecpglib/execute.c.
> Patch attached.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.

The patch looks correct, but I believe it's incomplete. It misses
several other places where ecpg_strdup() is called without proper
checks. A correct patch would look like the one attached.

While working on it I noticed a potentially problematic strcmp call,
marked with XXX in the patch. I didn't address this issue in v2.

Thoughts?

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Adding basic NUMA awareness
Next
From: Nathan Bossart
Date:
Subject: Re: CHECKPOINT unlogged data