ECPG: Free the malloc()'ed variables in the test so it comes out clean on

Valgrind runs.

Patch by Boszormenyi Zoltan <zb@cybertec.at>
This commit is contained in:
Michael Meskes 2013-11-26 17:14:07 +01:00
parent b46fa32100
commit db58e8ff7c
3 changed files with 16 additions and 10 deletions

View File

@ -347,28 +347,31 @@ if (sqlca.sqlcode < 0) exit (1);}
close_cur1();
free(myvar);
free(mynullvar);
strcpy(msg, "drop");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table a1", ECPGt_EOIT, ECPGt_EORT);
#line 115 "outofscope.pgc"
#line 118 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 115 "outofscope.pgc"
#line 118 "outofscope.pgc"
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 118 "outofscope.pgc"
#line 121 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 118 "outofscope.pgc"
#line 121 "outofscope.pgc"
strcpy(msg, "disconnect");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 121 "outofscope.pgc"
#line 124 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 121 "outofscope.pgc"
#line 124 "outofscope.pgc"
return (0);

View File

@ -102,13 +102,13 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 58: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 115: query: drop table a1; with 0 parameter(s) on connection regress1
[NO_PID]: ecpg_execute on line 118: query: drop table a1; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 115: using PQexec
[NO_PID]: ecpg_execute on line 118: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 115: OK: DROP TABLE
[NO_PID]: ecpg_execute on line 118: OK: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line 118: action "commit"; connection "regress1"
[NO_PID]: ECPGtrans on line 121: action "commit"; connection "regress1"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection regress1 closed
[NO_PID]: sqlca: code: 0, state: 00000

View File

@ -111,6 +111,9 @@ main (void)
close_cur1();
free(myvar);
free(mynullvar);
strcpy(msg, "drop");
exec sql drop table a1;