mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Fix minor memory leaks in pg_dump.
Coverity reported the two oversights in getPublicationTables. Valgrind found the one in determineNotNullFlags. The mistakes in getPublicationTables seem too minor to be worth back-patching. determineNotNullFlags could be run enough times to matter, but that code is new in v18. So, no back-patch.
This commit is contained in:
@ -4682,6 +4682,8 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
|
|||||||
appendPQExpBufferStr(attribs, fmtId(attnames[k]));
|
appendPQExpBufferStr(attribs, fmtId(attnames[k]));
|
||||||
}
|
}
|
||||||
pubrinfo[j].pubrattrs = attribs->data;
|
pubrinfo[j].pubrattrs = attribs->data;
|
||||||
|
free(attribs); /* but not attribs->data */
|
||||||
|
free(attnames);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pubrinfo[j].pubrattrs = NULL;
|
pubrinfo[j].pubrattrs = NULL;
|
||||||
@ -9424,6 +9426,7 @@ determineNotNullFlags(Archive *fout, PGresult *res, int r,
|
|||||||
tbinfo->notnull_constrs[j] =
|
tbinfo->notnull_constrs[j] =
|
||||||
pstrdup(PQgetvalue(res, r, i_notnull_name));
|
pstrdup(PQgetvalue(res, r, i_notnull_name));
|
||||||
}
|
}
|
||||||
|
free(default_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user