mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
Fix bug with illegal call to calloc.
This commit is contained in:
parent
aaf95b6c86
commit
f2a2ad59bc
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2000 by PostgreSQL Global Development Group
|
* Copyright 2000 by PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.23 2001/10/25 05:49:54 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.24 2001/10/29 06:45:32 ishii Exp $
|
||||||
*/
|
*/
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
@ -251,11 +251,18 @@ print_aligned_text(const char *title, const char *const * headers,
|
|||||||
for (ptr = cells; *ptr; ptr++)
|
for (ptr = cells; *ptr; ptr++)
|
||||||
cell_count++;
|
cell_count++;
|
||||||
|
|
||||||
cell_w = calloc(cell_count, sizeof(*cell_w));
|
if (cell_count > 0)
|
||||||
if (!cell_w)
|
|
||||||
{
|
{
|
||||||
perror("calloc");
|
cell_w = calloc(cell_count, sizeof(*cell_w));
|
||||||
exit(EXIT_FAILURE);
|
if (!cell_w)
|
||||||
|
{
|
||||||
|
perror("calloc");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cell_w = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -462,11 +469,18 @@ print_aligned_vertical(const char *title, const char *const * headers,
|
|||||||
for (ptr = cells; *ptr; ptr++)
|
for (ptr = cells; *ptr; ptr++)
|
||||||
cell_count++;
|
cell_count++;
|
||||||
|
|
||||||
cell_w = calloc(cell_count, sizeof(*cell_w));
|
if (cell_count > 0)
|
||||||
if (!cell_w)
|
|
||||||
{
|
{
|
||||||
perror("calloc");
|
cell_w = calloc(cell_count, sizeof(*cell_w));
|
||||||
exit(EXIT_FAILURE);
|
if (!cell_w)
|
||||||
|
{
|
||||||
|
perror("calloc");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cell_w = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find longest data cell */
|
/* find longest data cell */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user