Lists: | pgsql-patches |
---|
From: | Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | PQmakeEmptyPGresult() will return NULL if allocation fails |
Date: | 2005-06-10 07:34:29 |
Message-ID: | 7104a737050610003459059a91@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
PQmakeEmptyPGresult() will return NULL if malloc() fails for required
PGresult struct.
Attachment | Content-Type | Size |
---|---|---|
pq_empty_pgresult.diff | text/x-patch | 1.9 KB |
From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: PQmakeEmptyPGresult() will return NULL if allocation |
Date: | 2005-06-11 03:03:25 |
Message-ID: | 42AA547D.3090305@samurai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Volkan YAZICI wrote:
> PQmakeEmptyPGresult() will return NULL if malloc() fails for required
> PGresult struct.
Good catch. However, there's not much point having PQmakeEmptyPGresult()
return NULL on OOM if the various call sites of the function within
libpq don't check the return value and handle OOM themselves.
Some checking reveals that there are a few other bits of code in libpq
that don't handle malloc() failures correctly. I'll take a look at
fixing this today or tomorrow.
-Neil
From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | Neil Conway <neilc(at)samurai(dot)com> |
Cc: | Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: PQmakeEmptyPGresult() will return NULL if allocation |
Date: | 2005-06-11 12:36:21 |
Message-ID: | 42AADAC5.8010106@samurai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Neil Conway wrote:
> Some checking reveals that there are a few other bits of code in libpq
> that don't handle malloc() failures correctly. I'll take a look at
> fixing this today or tomorrow.
Attached is a patch that implements this. This adds checking for most of
the call sites of strdup(), malloc(), PQmakeEmptyPGresult(),
pqResultAlloc(), and pqResultStrdup() in libpq. Barring any objections,
I'll apply this to HEAD tomorrow.
-Neil
Attachment | Content-Type | Size |
---|---|---|
libpq_oom_handling-4.patch | text/x-patch | 29.7 KB |
From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: PQmakeEmptyPGresult() will return NULL if allocation |
Date: | 2005-06-12 00:11:46 |
Message-ID: | 42AB7DC2.4070401@samurai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Neil Conway wrote:
> Attached is a patch that implements this. This adds checking for most of
> the call sites of strdup(), malloc(), PQmakeEmptyPGresult(),
> pqResultAlloc(), and pqResultStrdup() in libpq. Barring any objections,
> I'll apply this to HEAD tomorrow.
Applied. Thanks for the report.
-Neil