Possible memory leak/memory issue in pg_dump

From: Joe Tennant <joetennant(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Possible memory leak/memory issue in pg_dump
Date: 2012-08-14 17:42:50
Message-ID: CAA28GAYDEpb3Ui0qK=xsLQUaThBg2y6Qyh+rO-hKphSisub5Hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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;
}

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2012-08-14 20:18:40 Re: BUG #6150: commit_delay should have unit ms
Previous Message Rikard Pavelic 2012-08-14 15:42:48 Re: BUG #7485: 9.2 beta3 libxml2 can't be loaded on Windows