Re: experimental pg_qcache patch - Mailing list pgsql-hackers

From Neil Conway
Subject Re: experimental pg_qcache patch
Date
Msg-id 20020414174124.6ab7810c.nconway@klamath.dyndns.org
Whole thread Raw
In response to Re: experimental pg_qcache patch  (Karel Zak <zakkr@zf.jcu.cz>)
List pgsql-hackers
On Sun, 14 Apr 2002 22:39:32 +0200
"Karel Zak" <zakkr@zf.jcu.cz> wrote:
>  - PREPARE_KEY_PREFIX_SIZE is 4 not 3
> 
>  - in the PrepareKey() is needful fix:
> 
> 
> +       if (store == PREPARE_STORE_SHARE) {     /* shared between same DB */
> +               *flag |= QCF_SHARE_NOTREMOVEABLE;
> +               key = (char *) palloc(strlen(name) + PREPARE_KEY_PREFIX_SIZE
> +                                       + strlen(DatabaseName) +1);
>                                                             ^^^^^^^
>                                                   must be 3 
> 
> +               sprintf(key, "%s_%s_", DatabaseName, PREPARE_KEY_PREFIX);
>                               ^^^^^^
>                  the space for '_' is not allocated :-(
> 
>  It's my bug probably, I good knew why we need leak detection :-)

Thanks Karel! I made the changes you suggest and the warning (and
the accompanying memory leak) have gone away.

Cheers,

Neil

-- 
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC


pgsql-hackers by date:

Previous
From: "Rod Taylor"
Date:
Subject: Re: command.c breakup
Next
From: John Gray
Date:
Subject: Re: command.c breakup