Skip to content

Commit 683f60d

Browse files
committed
Add mention of why malloc() has to be used in snprintf.c.
1 parent 8c72526 commit 683f60d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/port/snprintf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
* causing nasty effects.
6363
**************************************************************/
6464

65-
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.25 2005/03/20 03:53:39 momjian Exp $";*/
65+
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.26 2005/03/20 13:54:53 momjian Exp $";*/
6666

6767
static void dopr(char *buffer, const char *format, va_list args, char *end);
6868

@@ -225,6 +225,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
225225
if (*p == '%') /* counts %% as two, so overcounts */
226226
percents++;
227227

228+
/* Need to use malloc() because memory system might not be started yet. */
228229
if ((fmtpar = malloc(sizeof(struct fmtpar) * percents)) == NULL)
229230
{
230231
fprintf(stderr, _("out of memory\n"));

0 commit comments

Comments
 (0)