Re: Coccinelle for PostgreSQL development [4/N]: correcting palloc() use

2025-01-08 Thread Mats Kindahl
On Wed, Jan 8, 2025 at 10:02 PM Peter Eisentraut wrote: > On 07.01.25 20:49, Mats Kindahl wrote: > > This is the first example semantic patch and shows how to capture and > > fix a common problem. > > > > If you use an palloc() to allocate memory for an object (or an array of > > objects) and by

Re: Coccinelle for PostgreSQL development [4/N]: correcting palloc() use

2025-01-08 Thread Peter Eisentraut
On 07.01.25 20:49, Mats Kindahl wrote: This is the first example semantic patch and shows how to capture and fix a common problem. If you use an palloc() to allocate memory for an object (or an array of objects) and by mistake type something like:     StringInfoData *info = palloc(sizeof(St

Coccinelle for PostgreSQL development [4/N]: correcting palloc() use

2025-01-07 Thread Mats Kindahl
This is the first example semantic patch and shows how to capture and fix a common problem. If you use an palloc() to allocate memory for an object (or an array of objects) and by mistake type something like: StringInfoData *info = palloc(sizeof(StringInfoData*)); You will not allocate enoug