Skip to content

Commit db58e8f

Browse files
author
Michael Meskes
committed
ECPG: Free the malloc()'ed variables in the test so it comes out clean on
Valgrind runs. Patch by Boszormenyi Zoltan <zb@cybertec.at>
1 parent b46fa32 commit db58e8f

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

src/interfaces/ecpg/test/expected/preproc-outofscope.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,28 +347,31 @@ if (sqlca.sqlcode < 0) exit (1);}
347347

348348
close_cur1();
349349

350+
free(myvar);
351+
free(mynullvar);
352+
350353
strcpy(msg, "drop");
351354
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table a1", ECPGt_EOIT, ECPGt_EORT);
352-
#line 115 "outofscope.pgc"
355+
#line 118 "outofscope.pgc"
353356

354357
if (sqlca.sqlcode < 0) exit (1);}
355-
#line 115 "outofscope.pgc"
358+
#line 118 "outofscope.pgc"
356359

357360

358361
strcpy(msg, "commit");
359362
{ ECPGtrans(__LINE__, NULL, "commit");
360-
#line 118 "outofscope.pgc"
363+
#line 121 "outofscope.pgc"
361364

362365
if (sqlca.sqlcode < 0) exit (1);}
363-
#line 118 "outofscope.pgc"
366+
#line 121 "outofscope.pgc"
364367

365368

366369
strcpy(msg, "disconnect");
367370
{ ECPGdisconnect(__LINE__, "CURRENT");
368-
#line 121 "outofscope.pgc"
371+
#line 124 "outofscope.pgc"
369372

370373
if (sqlca.sqlcode < 0) exit (1);}
371-
#line 121 "outofscope.pgc"
374+
#line 124 "outofscope.pgc"
372375

373376

374377
return (0);

src/interfaces/ecpg/test/expected/preproc-outofscope.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@
102102
[NO_PID]: sqlca: code: 0, state: 00000
103103
[NO_PID]: ecpg_execute on line 58: OK: CLOSE CURSOR
104104
[NO_PID]: sqlca: code: 0, state: 00000
105-
[NO_PID]: ecpg_execute on line 115: query: drop table a1; with 0 parameter(s) on connection regress1
105+
[NO_PID]: ecpg_execute on line 118: query: drop table a1; with 0 parameter(s) on connection regress1
106106
[NO_PID]: sqlca: code: 0, state: 00000
107-
[NO_PID]: ecpg_execute on line 115: using PQexec
107+
[NO_PID]: ecpg_execute on line 118: using PQexec
108108
[NO_PID]: sqlca: code: 0, state: 00000
109-
[NO_PID]: ecpg_execute on line 115: OK: DROP TABLE
109+
[NO_PID]: ecpg_execute on line 118: OK: DROP TABLE
110110
[NO_PID]: sqlca: code: 0, state: 00000
111-
[NO_PID]: ECPGtrans on line 118: action "commit"; connection "regress1"
111+
[NO_PID]: ECPGtrans on line 121: action "commit"; connection "regress1"
112112
[NO_PID]: sqlca: code: 0, state: 00000
113113
[NO_PID]: ecpg_finish: connection regress1 closed
114114
[NO_PID]: sqlca: code: 0, state: 00000

src/interfaces/ecpg/test/preproc/outofscope.pgc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ main (void)
111111

112112
close_cur1();
113113

114+
free(myvar);
115+
free(mynullvar);
116+
114117
strcpy(msg, "drop");
115118
exec sql drop table a1;
116119

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