Seems to be a simple unchecked return value...I'm testing with this, but won't
endeavor to propose a formal patch.
pg_dump.c
if (copybuf)
{
int ret2;
ret2=WriteData(fout, copybuf, ret);
if (ret!=ret2) {
exit_horribly(NULL, "error writing, (%d %d)\n", ret, ret2);
}
PQfreemem(copybuf);
}