From: Michael Meskes Date: Tue, 15 Aug 2006 12:46:25 +0000 (+0000) Subject: Fixed a typo and made two mallocs Coverity friendly. X-Git-Tag: REL8_2_BETA1~311 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2834fb6a834342e5298609e371183521b395675e;p=postgresql Fixed a typo and made two mallocs Coverity friendly. --- diff --git a/src/interfaces/ecpg/test/compat_informix/dec_test.pgc b/src/interfaces/ecpg/test/compat_informix/dec_test.pgc index 8f6f109dcf..8e333206b5 100644 --- a/src/interfaces/ecpg/test/compat_informix/dec_test.pgc +++ b/src/interfaces/ecpg/test/compat_informix/dec_test.pgc @@ -38,7 +38,7 @@ main(void) long l; int i, j, k, q, r, count = 0; double dbl; - decimal **decarr = (decimal **) malloc(1); + decimal **decarr = (decimal **) calloc(1, sizeof(decimal)); ECPGdebug(1, stderr); @@ -71,7 +71,7 @@ main(void) din = PGTYPESdecimal_new(); r = dectoasc(din, buf, BUFSIZE-1, 2); - if (!r < 0) check_errno(); + if (r < 0) check_errno(); printf("dec[%d,5]: r: %d, %s\n", i, r, buf); r = dectolong(dec, &l); diff --git a/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c index fd5d5c7868..f9f0bf3ab1 100644 --- a/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c +++ b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c @@ -58,7 +58,7 @@ main(void) long l; int i, j, k, q, r, count = 0; double dbl; - decimal **decarr = (decimal **) malloc(1); + decimal **decarr = (decimal **) calloc(1, sizeof(decimal)); ECPGdebug(1, stderr); @@ -91,7 +91,7 @@ main(void) din = PGTYPESdecimal_new(); r = dectoasc(din, buf, BUFSIZE-1, 2); - if (!r < 0) check_errno(); + if (r < 0) check_errno(); printf("dec[%d,5]: r: %d, %s\n", i, r, buf); r = dectolong(dec, &l); diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c index 6fa54a4c25..3e20f10b1a 100644 --- a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c +++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c @@ -48,7 +48,7 @@ main(void) long l; int i, j, k, q, r, count = 0; double d; - numeric **numarr = (numeric **) malloc(1); + numeric **numarr = (numeric **) calloc(1, sizeof(numeric)); ECPGdebug(1, stderr); diff --git a/src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc b/src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc index 19329cedb2..c4bbe74441 100644 --- a/src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc +++ b/src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc @@ -30,7 +30,7 @@ main(void) long l; int i, j, k, q, r, count = 0; double d; - numeric **numarr = (numeric **) malloc(1); + numeric **numarr = (numeric **) calloc(1, sizeof(numeric)); ECPGdebug(1, stderr);