In dumputils, we may have successfully parsed the acls when we discover
that we can't parse the reverse ACLs and then return- check and free
aclitems if that happens.
In dumpTableSchema, move ftoptions and srvname under the relkind !=
RELKIND_VIEW branch (since they're only used there) and then check if
they've been allocated and, if so, free them at the end of that block.
Pointed out by Pavel Raiskup, though I didn't use those patches.
Discussion: https://postgr.es/m/
2183976.vkCJMhdhmF@nb.usersys.redhat.com
{
if (!parsePGArray(racls, &raclitems, &nraclitems))
{
+ if (aclitems)
+ free(aclitems);
if (raclitems)
free(raclitems);
return false;
int actual_atts; /* number of attrs in this CREATE statement */
const char *reltypename;
char *storage;
- char *srvname;
- char *ftoptions;
int j,
k;
}
else
{
+ char *ftoptions = NULL;
+ char *srvname = NULL;
+
switch (tbinfo->relkind)
{
case RELKIND_FOREIGN_TABLE:
}
case RELKIND_MATVIEW:
reltypename = "MATERIALIZED VIEW";
- srvname = NULL;
- ftoptions = NULL;
break;
default:
reltypename = "TABLE";
- srvname = NULL;
- ftoptions = NULL;
}
numParents = tbinfo->numParents;
tbinfo->attfdwoptions[j]);
}
}
+
+ if (ftoptions)
+ free(ftoptions);
+ if (srvname)
+ free(srvname);
}
/*