Thread: fix memory leaks in pg_dump

fix memory leaks in pg_dump

From
Neil Conway
Date:
This patch fixes two tiny memory leaks in pg_dump.

Cheers,

Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC


Index: src/bin/pg_dump/pg_dump.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.308
diff -c -r1.308 pg_dump.c
*** src/bin/pg_dump/pg_dump.c    23 Nov 2002 03:59:08 -0000    1.308
--- src/bin/pg_dump/pg_dump.c    27 Nov 2002 21:37:06 -0000
***************
*** 3226,3231 ****
--- 3226,3232 ----
                        "WHERE contypid = '%s'::pg_catalog.oid",
                        tinfo->oid);

+     PQclear(res);
      res = PQexec(g_conn, chkquery->data);
      if (!res ||
          PQresultStatus(res) != PGRES_TUPLES_OK)
***************
*** 3269,3274 ****
--- 3270,3276 ----
      destroyPQExpBuffer(q);
      destroyPQExpBuffer(delq);
      destroyPQExpBuffer(query);
+     destroyPQExpBuffer(chkquery);
  }

  /*

Re: fix memory leaks in pg_dump

From
Bruce Momjian
Date:
Sorry I hadn't gotten to adding your identical submission of Nov 23 to
the queue.

Your patch has been added to the PostgreSQL unapplied patches list at:

    http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Neil Conway wrote:
> This patch fixes two tiny memory leaks in pg_dump.
>
> Cheers,
>
> Neil
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
>
>

[ text/x-patch is unsupported, treating like TEXT/PLAIN ]

> Index: src/bin/pg_dump/pg_dump.c
> ===================================================================
> RCS file: /var/lib/cvs/pgsql-server/src/bin/pg_dump/pg_dump.c,v
> retrieving revision 1.308
> diff -c -r1.308 pg_dump.c
> *** src/bin/pg_dump/pg_dump.c    23 Nov 2002 03:59:08 -0000    1.308
> --- src/bin/pg_dump/pg_dump.c    27 Nov 2002 21:37:06 -0000
> ***************
> *** 3226,3231 ****
> --- 3226,3232 ----
>                         "WHERE contypid = '%s'::pg_catalog.oid",
>                         tinfo->oid);
>
> +     PQclear(res);
>       res = PQexec(g_conn, chkquery->data);
>       if (!res ||
>           PQresultStatus(res) != PGRES_TUPLES_OK)
> ***************
> *** 3269,3274 ****
> --- 3270,3276 ----
>       destroyPQExpBuffer(q);
>       destroyPQExpBuffer(delq);
>       destroyPQExpBuffer(query);
> +     destroyPQExpBuffer(chkquery);
>   }
>
>   /*

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: fix memory leaks in pg_dump

From
Neil Conway
Date:
On Wed, 2002-11-27 at 17:20, Bruce Momjian wrote:
> Sorry I hadn't gotten to adding your identical submission of Nov 23 to
> the queue.

Actually, this is a different patch: the Nov. 23 patch fixes leaks in
pg_dumpall, this one fixes leaks in pg_dump.

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC




Re: fix memory leaks in pg_dump

From
Bruce Momjian
Date:
Thanks for pointing that out.  Both in queue now.

---------------------------------------------------------------------------

Neil Conway wrote:
> On Wed, 2002-11-27 at 17:20, Bruce Momjian wrote:
> > Sorry I hadn't gotten to adding your identical submission of Nov 23 to
> > the queue.
>
> Actually, this is a different patch: the Nov. 23 patch fixes leaks in
> pg_dumpall, this one fixes leaks in pg_dump.
>
> Cheers,
>
> Neil
>
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: fix memory leaks in pg_dump

From
Bruce Momjian
Date:
Patch applied.  Thanks.

---------------------------------------------------------------------------


Neil Conway wrote:
> This patch fixes two tiny memory leaks in pg_dump.
>
> Cheers,
>
> Neil
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
>
>

[ text/x-patch is unsupported, treating like TEXT/PLAIN ]

> Index: src/bin/pg_dump/pg_dump.c
> ===================================================================
> RCS file: /var/lib/cvs/pgsql-server/src/bin/pg_dump/pg_dump.c,v
> retrieving revision 1.308
> diff -c -r1.308 pg_dump.c
> *** src/bin/pg_dump/pg_dump.c    23 Nov 2002 03:59:08 -0000    1.308
> --- src/bin/pg_dump/pg_dump.c    27 Nov 2002 21:37:06 -0000
> ***************
> *** 3226,3231 ****
> --- 3226,3232 ----
>                         "WHERE contypid = '%s'::pg_catalog.oid",
>                         tinfo->oid);
>
> +     PQclear(res);
>       res = PQexec(g_conn, chkquery->data);
>       if (!res ||
>           PQresultStatus(res) != PGRES_TUPLES_OK)
> ***************
> *** 3269,3274 ****
> --- 3270,3276 ----
>       destroyPQExpBuffer(q);
>       destroyPQExpBuffer(delq);
>       destroyPQExpBuffer(query);
> +     destroyPQExpBuffer(chkquery);
>   }
>
>   /*

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073