Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9805abb

Browse files
committed
This patch solves a couple of memory leaks in ecpglib.c. The patch isok for both thedevelopment tree (CVS) and for 6.5.3. Stephen Birch
1 parent7431796 commit9805abb

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

‎src/interfaces/ecpg/lib/ecpglib.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,13 @@ ECPGexecute(struct statement * stmt)
528528
{
529529
intslen=strlen((char*)var->value);
530530

531-
if (!(newcopy=ecpg_alloc(slen+1,stmt->lineno)))
531+
if (!(mallocedval=ecpg_alloc(slen+1,stmt->lineno)))
532532
return false;
533533

534-
strncpy(newcopy, (char*)var->value,slen);
535-
newcopy[slen]='\0';
534+
strncpy(mallocedval, (char*)var->value,slen);
535+
mallocedval[slen]='\0';
536536

537-
tobeinserted=newcopy;
537+
tobeinserted=mallocedval;
538538
}
539539
break;
540540
caseECPGt_varchar:
@@ -1132,13 +1132,13 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
11321132
con->committed= true;
11331133

11341134
/* deallocate all prepared statements */
1135-
for (this=prep_stmts;this!=NULL;this=this->next)
1136-
{
1137-
boolb=ECPGdeallocate(lineno,this->name);
1135+
while(prep_stmts!=NULL) {
1136+
boolb=ECPGdeallocate(lineno,prep_stmts->name);
11381137

11391138
if (!b)
11401139
return false;
11411140
}
1141+
11421142
}
11431143

11441144
return true;
@@ -1416,6 +1416,7 @@ ECPGdeallocate(int lineno, char *name)
14161416
else
14171417
prep_stmts=this->next;
14181418

1419+
free(this);
14191420
return true;
14201421
}
14211422
ECPGlog("deallocate_prepare: invalid statement name %s\n",name);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp