mirror of https://github.com/postgres/postgres
Add mention of why malloc() has to be used in snprintf.c.
This commit is contained in:
parent
8c72526fe9
commit
683f60da3d
|
@ -62,7 +62,7 @@
|
||||||
* causing nasty effects.
|
* causing nasty effects.
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.25 2005/03/20 03:53:39 momjian Exp $";*/
|
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.26 2005/03/20 13:54:53 momjian Exp $";*/
|
||||||
|
|
||||||
static void dopr(char *buffer, const char *format, va_list args, char *end);
|
static void dopr(char *buffer, const char *format, va_list args, char *end);
|
||||||
|
|
||||||
|
@ -225,6 +225,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
|
||||||
if (*p == '%') /* counts %% as two, so overcounts */
|
if (*p == '%') /* counts %% as two, so overcounts */
|
||||||
percents++;
|
percents++;
|
||||||
|
|
||||||
|
/* Need to use malloc() because memory system might not be started yet. */
|
||||||
if ((fmtpar = malloc(sizeof(struct fmtpar) * percents)) == NULL)
|
if ((fmtpar = malloc(sizeof(struct fmtpar) * percents)) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("out of memory\n"));
|
fprintf(stderr, _("out of memory\n"));
|
||||||
|
|
Loading…
Reference in New Issue