* be PG_CONTROL_FILE_SIZE, but the part that fits in our buffer is
* shorter, just sizeof(ControlFileData).
*/
- if (mystreamer->control_file_bytes <= sizeof(ControlFileData))
+ if (mystreamer->control_file_bytes < sizeof(ControlFileData))
{
- int remaining;
+ size_t remaining;
remaining = sizeof(ControlFileData) - mystreamer->control_file_bytes;
memcpy(((char *) &mystreamer->control_file)
+ mystreamer->control_file_bytes,
- data, Min(len, remaining));
+ data, Min((size_t) len, remaining));
}
/* Remember how many bytes we saw, even if we didn't buffer them. */
* result is 0, or if the value is too large to be a valid OID.
*/
if (suffix == NULL || num <= 0 || num > OID_MAX)
+ {
report_backup_error(context,
"file \"%s\" is not expected in a tar format backup",
relpath);
+ return;
+ }
tblspc_oid = (Oid) num;
}
progress_report(false);
}
+ pg_free(buffer);
+
if (rc < 0)
report_backup_error(context, "could not read file \"%s\": %m",
relpath);