Skip to content

Commit 42ccbe4

Browse files
author
Michael Meskes
committed
Free memory in ecpg bytea regression test.
While not really a problem it's easier to run tools like valgrind against it when fixed.
1 parent 0cc0507 commit 42ccbe4

File tree

3 files changed

+59
-57
lines changed

3 files changed

+59
-57
lines changed

src/interfaces/ecpg/test/expected/sql-bytea.c

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -200,116 +200,117 @@ if (sqlca.sqlcode < 0) sqlprint();}
200200

201201
dump_binary(recv_vlen_buf[0].arr, recv_vlen_buf[0].len, 0);
202202
dump_binary(recv_vlen_buf[1].arr, recv_vlen_buf[1].len, 0);
203+
free(recv_vlen_buf);
203204

204205
/* Test for dynamic sql statement with normal host variable, indicator */
205206
init();
206207
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
207-
#line 86 "bytea.pgc"
208+
#line 87 "bytea.pgc"
208209

209210
if (sqlca.sqlcode < 0) sqlprint();}
210-
#line 86 "bytea.pgc"
211+
#line 87 "bytea.pgc"
211212

212213
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "ins_stmt",
213214
ECPGt_bytea,&(send_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1),
214215
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
215216
ECPGt_bytea,&(send_buf[1]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1),
216217
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
217-
#line 87 "bytea.pgc"
218+
#line 88 "bytea.pgc"
218219

219220
if (sqlca.sqlcode < 0) sqlprint();}
220-
#line 87 "bytea.pgc"
221+
#line 88 "bytea.pgc"
221222

222223
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "sel_stmt", ECPGt_EOIT,
223224
ECPGt_bytea,&(recv_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_2),
224225
ECPGt_int,&(ind[0]),(long)1,(long)1,sizeof(int),
225226
ECPGt_bytea,&(recv_short_buf),(long)DATA_SIZE - LACK_SIZE,(long)1,sizeof(struct bytea_4),
226227
ECPGt_int,&(ind[1]),(long)1,(long)1,sizeof(int), ECPGt_EORT);
227-
#line 88 "bytea.pgc"
228+
#line 89 "bytea.pgc"
228229

229230
if (sqlca.sqlcode < 0) sqlprint();}
230-
#line 88 "bytea.pgc"
231+
#line 89 "bytea.pgc"
231232

232233
dump_binary(recv_buf[0].arr, recv_buf[0].len, ind[0]);
233234
dump_binary(recv_short_buf.arr, recv_short_buf.len, ind[1]);
234235

235236
/* Test for dynamic sql statement with sql descriptor */
236237
init();
237238
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
238-
#line 94 "bytea.pgc"
239+
#line 95 "bytea.pgc"
239240

240241
if (sqlca.sqlcode < 0) sqlprint();}
241-
#line 94 "bytea.pgc"
242+
#line 95 "bytea.pgc"
242243

243244
{ ECPGset_desc(__LINE__, "idesc", 1,ECPGd_data,
244245
ECPGt_bytea,&(send_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1), ECPGd_EODT);
245246

246-
#line 95 "bytea.pgc"
247+
#line 96 "bytea.pgc"
247248

248249
if (sqlca.sqlcode < 0) sqlprint();}
249-
#line 95 "bytea.pgc"
250+
#line 96 "bytea.pgc"
250251

251252
{ ECPGset_desc(__LINE__, "idesc", 2,ECPGd_data,
252253
ECPGt_bytea,&(send_buf[1]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_1), ECPGd_EODT);
253254

254-
#line 96 "bytea.pgc"
255+
#line 97 "bytea.pgc"
255256

256257
if (sqlca.sqlcode < 0) sqlprint();}
257-
#line 96 "bytea.pgc"
258+
#line 97 "bytea.pgc"
258259

259260
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "ins_stmt",
260261
ECPGt_descriptor, "idesc", 1L, 1L, 1L,
261262
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
262-
#line 97 "bytea.pgc"
263+
#line 98 "bytea.pgc"
263264

264265
if (sqlca.sqlcode < 0) sqlprint();}
265-
#line 97 "bytea.pgc"
266+
#line 98 "bytea.pgc"
266267

267268
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "sel_stmt", ECPGt_EOIT,
268269
ECPGt_descriptor, "odesc", 1L, 1L, 1L,
269270
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
270-
#line 98 "bytea.pgc"
271+
#line 99 "bytea.pgc"
271272

272273
if (sqlca.sqlcode < 0) sqlprint();}
273-
#line 98 "bytea.pgc"
274+
#line 99 "bytea.pgc"
274275

275276
{ ECPGget_desc(__LINE__, "odesc", 1,ECPGd_indicator,
276277
ECPGt_int,&(ind[0]),(long)1,(long)1,sizeof(int), ECPGd_data,
277278
ECPGt_bytea,&(recv_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_2), ECPGd_EODT);
278279

279-
#line 99 "bytea.pgc"
280+
#line 100 "bytea.pgc"
280281

281282
if (sqlca.sqlcode < 0) sqlprint();}
282-
#line 99 "bytea.pgc"
283+
#line 100 "bytea.pgc"
283284

284285
{ ECPGget_desc(__LINE__, "odesc", 2,ECPGd_indicator,
285286
ECPGt_int,&(ind[1]),(long)1,(long)1,sizeof(int), ECPGd_data,
286287
ECPGt_bytea,&(recv_short_buf),(long)DATA_SIZE - LACK_SIZE,(long)1,sizeof(struct bytea_4), ECPGd_EODT);
287288

288-
#line 100 "bytea.pgc"
289+
#line 101 "bytea.pgc"
289290

290291
if (sqlca.sqlcode < 0) sqlprint();}
291-
#line 100 "bytea.pgc"
292+
#line 101 "bytea.pgc"
292293

293294
dump_binary(recv_buf[0].arr, recv_buf[0].len, ind[0]);
294295
dump_binary(recv_short_buf.arr, recv_short_buf.len, ind[1]);
295296

296297
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
297-
#line 104 "bytea.pgc"
298+
#line 105 "bytea.pgc"
298299

299300
if (sqlca.sqlcode < 0) sqlprint();}
300-
#line 104 "bytea.pgc"
301+
#line 105 "bytea.pgc"
301302

302303
{ ECPGtrans(__LINE__, NULL, "commit");
303-
#line 105 "bytea.pgc"
304+
#line 106 "bytea.pgc"
304305

305306
if (sqlca.sqlcode < 0) sqlprint();}
306-
#line 105 "bytea.pgc"
307+
#line 106 "bytea.pgc"
307308

308309
{ ECPGdisconnect(__LINE__, "CURRENT");
309-
#line 106 "bytea.pgc"
310+
#line 107 "bytea.pgc"
310311

311312
if (sqlca.sqlcode < 0) sqlprint();}
312-
#line 106 "bytea.pgc"
313+
#line 107 "bytea.pgc"
313314

314315

315316
return 0;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy