Use pg_malloc0() instead of malloc()

See also d08bd352c1
This commit is contained in:
Ian Barwick
2015-10-26 15:33:51 +09:00
parent a59ea243c0
commit 34af7dec2a

View File

@@ -890,7 +890,7 @@ start_backup(PGconn *conn, char *first_wal_segment, bool fast_checkpoint)
char *first_wal_seg_pq = PQgetvalue(res, 0, 0);
size_t buf_sz = strlen(first_wal_seg_pq);
first_wal_segment = malloc(buf_sz + 1);
first_wal_segment = pg_malloc0(buf_sz + 1);
xsnprintf(first_wal_segment, buf_sz + 1, "%s", first_wal_seg_pq);
}
@@ -921,7 +921,7 @@ stop_backup(PGconn *conn, char *last_wal_segment)
char *last_wal_seg_pq = PQgetvalue(res, 0, 0);
size_t buf_sz = strlen(last_wal_seg_pq);
last_wal_segment = malloc(buf_sz + 1);
last_wal_segment = pg_malloc0(buf_sz + 1);
xsnprintf(last_wal_segment, buf_sz + 1, "%s", last_wal_seg_pq);
}