Commit 42ccbe43 authored by Michael Meskes's avatar Michael Meskes

Free memory in ecpg bytea regression test.

While not really a problem it's easier to run tools like valgrind against it
when fixed.
parent 0cc05079
...@@ -200,34 +200,35 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -200,34 +200,35 @@ if (sqlca.sqlcode < 0) sqlprint();}
dump_binary(recv_vlen_buf[0].arr, recv_vlen_buf[0].len, 0); dump_binary(recv_vlen_buf[0].arr, recv_vlen_buf[0].len, 0);
dump_binary(recv_vlen_buf[1].arr, recv_vlen_buf[1].len, 0); dump_binary(recv_vlen_buf[1].arr, recv_vlen_buf[1].len, 0);
free(recv_vlen_buf);
/* Test for dynamic sql statement with normal host variable, indicator */ /* Test for dynamic sql statement with normal host variable, indicator */
init(); init();
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
#line 86 "bytea.pgc" #line 87 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 86 "bytea.pgc" #line 87 "bytea.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "ins_stmt", { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "ins_stmt",
ECPGt_bytea,&(send_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1), ECPGt_bytea,&(send_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_bytea,&(send_buf[1]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1), ECPGt_bytea,&(send_buf[1]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 87 "bytea.pgc" #line 88 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 87 "bytea.pgc" #line 88 "bytea.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "sel_stmt", ECPGt_EOIT, { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "sel_stmt", ECPGt_EOIT,
ECPGt_bytea,&(recv_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_2), ECPGt_bytea,&(recv_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_2),
ECPGt_int,&(ind[0]),(long)1,(long)1,sizeof(int), ECPGt_int,&(ind[0]),(long)1,(long)1,sizeof(int),
ECPGt_bytea,&(recv_short_buf),(long)DATA_SIZE - LACK_SIZE,(long)1,sizeof(struct bytea_4), ECPGt_bytea,&(recv_short_buf),(long)DATA_SIZE - LACK_SIZE,(long)1,sizeof(struct bytea_4),
ECPGt_int,&(ind[1]),(long)1,(long)1,sizeof(int), ECPGt_EORT); ECPGt_int,&(ind[1]),(long)1,(long)1,sizeof(int), ECPGt_EORT);
#line 88 "bytea.pgc" #line 89 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 88 "bytea.pgc" #line 89 "bytea.pgc"
dump_binary(recv_buf[0].arr, recv_buf[0].len, ind[0]); dump_binary(recv_buf[0].arr, recv_buf[0].len, ind[0]);
dump_binary(recv_short_buf.arr, recv_short_buf.len, ind[1]); dump_binary(recv_short_buf.arr, recv_short_buf.len, ind[1]);
...@@ -235,81 +236,81 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -235,81 +236,81 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* Test for dynamic sql statement with sql descriptor */ /* Test for dynamic sql statement with sql descriptor */
init(); init();
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
#line 94 "bytea.pgc" #line 95 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 94 "bytea.pgc" #line 95 "bytea.pgc"
{ ECPGset_desc(__LINE__, "idesc", 1,ECPGd_data, { ECPGset_desc(__LINE__, "idesc", 1,ECPGd_data,
ECPGt_bytea,&(send_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1), ECPGd_EODT); ECPGt_bytea,&(send_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1), ECPGd_EODT);
#line 95 "bytea.pgc" #line 96 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 95 "bytea.pgc" #line 96 "bytea.pgc"
{ ECPGset_desc(__LINE__, "idesc", 2,ECPGd_data, { ECPGset_desc(__LINE__, "idesc", 2,ECPGd_data,
ECPGt_bytea,&(send_buf[1]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1), ECPGd_EODT); ECPGt_bytea,&(send_buf[1]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1), ECPGd_EODT);
#line 96 "bytea.pgc" #line 97 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 96 "bytea.pgc" #line 97 "bytea.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "ins_stmt", { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "ins_stmt",
ECPGt_descriptor, "idesc", 1L, 1L, 1L, ECPGt_descriptor, "idesc", 1L, 1L, 1L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 97 "bytea.pgc" #line 98 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 97 "bytea.pgc" #line 98 "bytea.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "sel_stmt", ECPGt_EOIT, { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "sel_stmt", ECPGt_EOIT,
ECPGt_descriptor, "odesc", 1L, 1L, 1L, ECPGt_descriptor, "odesc", 1L, 1L, 1L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 98 "bytea.pgc" #line 99 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 98 "bytea.pgc" #line 99 "bytea.pgc"
{ ECPGget_desc(__LINE__, "odesc", 1,ECPGd_indicator, { ECPGget_desc(__LINE__, "odesc", 1,ECPGd_indicator,
ECPGt_int,&(ind[0]),(long)1,(long)1,sizeof(int), ECPGd_data, ECPGt_int,&(ind[0]),(long)1,(long)1,sizeof(int), ECPGd_data,
ECPGt_bytea,&(recv_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_2), ECPGd_EODT); ECPGt_bytea,&(recv_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_2), ECPGd_EODT);
#line 99 "bytea.pgc" #line 100 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 99 "bytea.pgc" #line 100 "bytea.pgc"
{ ECPGget_desc(__LINE__, "odesc", 2,ECPGd_indicator, { ECPGget_desc(__LINE__, "odesc", 2,ECPGd_indicator,
ECPGt_int,&(ind[1]),(long)1,(long)1,sizeof(int), ECPGd_data, ECPGt_int,&(ind[1]),(long)1,(long)1,sizeof(int), ECPGd_data,
ECPGt_bytea,&(recv_short_buf),(long)DATA_SIZE - LACK_SIZE,(long)1,sizeof(struct bytea_4), ECPGd_EODT); ECPGt_bytea,&(recv_short_buf),(long)DATA_SIZE - LACK_SIZE,(long)1,sizeof(struct bytea_4), ECPGd_EODT);
#line 100 "bytea.pgc" #line 101 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 100 "bytea.pgc" #line 101 "bytea.pgc"
dump_binary(recv_buf[0].arr, recv_buf[0].len, ind[0]); dump_binary(recv_buf[0].arr, recv_buf[0].len, ind[0]);
dump_binary(recv_short_buf.arr, recv_short_buf.len, ind[1]); dump_binary(recv_short_buf.arr, recv_short_buf.len, ind[1]);
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
#line 104 "bytea.pgc" #line 105 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 104 "bytea.pgc" #line 105 "bytea.pgc"
{ ECPGtrans(__LINE__, NULL, "commit"); { ECPGtrans(__LINE__, NULL, "commit");
#line 105 "bytea.pgc" #line 106 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 105 "bytea.pgc" #line 106 "bytea.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT"); { ECPGdisconnect(__LINE__, "CURRENT");
#line 106 "bytea.pgc" #line 107 "bytea.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 106 "bytea.pgc" #line 107 "bytea.pgc"
return 0; return 0;
......
...@@ -80,6 +80,7 @@ while (0) ...@@ -80,6 +80,7 @@ while (0)
exec sql select data1 into :recv_vlen_buf from test; exec sql select data1 into :recv_vlen_buf from test;
dump_binary(recv_vlen_buf[0].arr, recv_vlen_buf[0].len, 0); dump_binary(recv_vlen_buf[0].arr, recv_vlen_buf[0].len, 0);
dump_binary(recv_vlen_buf[1].arr, recv_vlen_buf[1].len, 0); dump_binary(recv_vlen_buf[1].arr, recv_vlen_buf[1].len, 0);
free(recv_vlen_buf);
/* Test for dynamic sql statement with normal host variable, indicator */ /* Test for dynamic sql statement with normal host variable, indicator */
init(); init();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment