Skip to content

Commit 2834fb6

Browse files
author
Michael Meskes
committed
Fixed a typo and made two mallocs Coverity friendly.
1 parent 4a445f5 commit 2834fb6

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/interfaces/ecpg/test/compat_informix/dec_test.pgc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ main(void)
3838
long l;
3939
int i, j, k, q, r, count = 0;
4040
double dbl;
41-
decimal **decarr = (decimal **) malloc(1);
41+
decimal **decarr = (decimal **) calloc(1, sizeof(decimal));
4242

4343
ECPGdebug(1, stderr);
4444

@@ -71,7 +71,7 @@ main(void)
7171

7272
din = PGTYPESdecimal_new();
7373
r = dectoasc(din, buf, BUFSIZE-1, 2);
74-
if (!r < 0) check_errno();
74+
if (r < 0) check_errno();
7575
printf("dec[%d,5]: r: %d, %s\n", i, r, buf);
7676

7777
r = dectolong(dec, &l);

src/interfaces/ecpg/test/expected/compat_informix-dec_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ main(void)
5858
long l;
5959
int i, j, k, q, r, count = 0;
6060
double dbl;
61-
decimal **decarr = (decimal **) malloc(1);
61+
decimal **decarr = (decimal **) calloc(1, sizeof(decimal));
6262

6363
ECPGdebug(1, stderr);
6464

@@ -91,7 +91,7 @@ main(void)
9191

9292
din = PGTYPESdecimal_new();
9393
r = dectoasc(din, buf, BUFSIZE-1, 2);
94-
if (!r < 0) check_errno();
94+
if (r < 0) check_errno();
9595
printf("dec[%d,5]: r: %d, %s\n", i, r, buf);
9696

9797
r = dectolong(dec, &l);

src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ main(void)
4848
long l;
4949
int i, j, k, q, r, count = 0;
5050
double d;
51-
numeric **numarr = (numeric **) malloc(1);
51+
numeric **numarr = (numeric **) calloc(1, sizeof(numeric));
5252

5353
ECPGdebug(1, stderr);
5454

src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ main(void)
3030
long l;
3131
int i, j, k, q, r, count = 0;
3232
double d;
33-
numeric **numarr = (numeric **) malloc(1);
33+
numeric **numarr = (numeric **) calloc(1, sizeof(numeric));
3434

3535
ECPGdebug(1, stderr);
3636

0 commit comments

Comments
 (0)