pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedPossible memory leak/memory issue in pg_dump
2+ messages / 2 participants
[nested] [flat]
* Possible memory leak/memory issue in pg_dump
@ 2012-08-14 17:42 Joe Tennant <joetennant@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Joe Tennant @ 2012-08-14 17:42 UTC (permalink / raw)
To: pgsql-bugs
While browsing the code, "pg_dump.c" the following block *appears* to
be problematic. Additionally, there *appears* to be a malloc without a
free (return or assignment) in the function "getBlobs(Archive *AH)"
(pg_dump.c lines 2169 thru 2188 v9.1.4).
/*
* Each large object has its own BLOB archive entry.
*/
binfo = (BlobInfo *) malloc(ntups * sizeof(BlobInfo));
for (i = 0; i < ntups; i++)
{
binfo[i].dobj.objType = DO_BLOB;
binfo[i].dobj.catId.tableoid = LargeObjectRelationId;
binfo[i].dobj.catId.oid = atooid(PQgetvalue(res, i, 0));
AssignDumpId(&binfo[i].dobj);
binfo[i].dobj.name = strdup(PQgetvalue(res, i, 0));
if (!PQgetisnull(res, i, 1))
binfo[i].rolname = strdup(PQgetvalue(res, i, 1));
else
binfo[i].rolname = "";
if (!PQgetisnull(res, i, 2))
binfo[i].blobacl = strdup(PQgetvalue(res, i, 2));
else
binfo[i].blobacl = NULL;
}
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Possible memory leak/memory issue in pg_dump
@ 2012-08-14 21:30 Tom Lane <tgl@sss.pgh.pa.us>
parent: Joe Tennant <joetennant@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2012-08-14 21:30 UTC (permalink / raw)
To: Joe Tennant <joetennant@gmail.com>; +Cc: pgsql-bugs
Joe Tennant <joetennant@gmail.com> writes:
> While browsing the code, "pg_dump.c" the following block *appears* to
> be problematic. Additionally, there *appears* to be a malloc without a
> free (return or assignment) in the function "getBlobs(Archive *AH)"
> (pg_dump.c lines 2169 thru 2188 v9.1.4).
All those data structures are supposed to survive for the life of the
pg_dump run, so this isn't a leak.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2012-08-14 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-08-14 17:42 Possible memory leak/memory issue in pg_dump Joe Tennant <joetennant@gmail.com>
2012-08-14 21:30 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox