0002-use-pg_malloc-instead-of-an-unchecked-malloc-in-pg_r.patch
text/x-patch
Filename: 0002-use-pg_malloc-instead-of-an-unchecked-malloc-in-pg_r.patch
Type: text/x-patch
Part: 0
Patch
Format: unified
Series: patch 0002
| File | + | − |
|---|---|---|
| src/bin/pg_resetxlog/pg_resetxlog.c | 3 | 2 |
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c index 8734f2c..60fb30c 100644 --- a/src/bin/pg_resetxlog/pg_resetxlog.c +++ b/src/bin/pg_resetxlog/pg_resetxlog.c @@ -54,6 +54,7 @@ #include "access/xlog_internal.h" #include "catalog/catversion.h" #include "catalog/pg_control.h" +#include "port/palloc.h" extern int optind; extern char *optarg; @@ -390,7 +391,7 @@ ReadControlFile(void) } /* Use malloc to ensure we have a maxaligned buffer */ - buffer = (char *) malloc(PG_CONTROL_SIZE); + buffer = (char *) pg_malloc(PG_CONTROL_SIZE); len = read(fd, buffer, PG_CONTROL_SIZE); if (len < 0) @@ -904,7 +905,7 @@ WriteEmptyXLOG(void) int nbytes; /* Use malloc() to ensure buffer is MAXALIGNED */ - buffer = (char *) malloc(XLOG_BLCKSZ); + buffer = (char *) pg_malloc(XLOG_BLCKSZ); page = (XLogPageHeader) buffer; memset(buffer, 0, XLOG_BLCKSZ);