From 4e8954188850061d06183ad502d35b9b38db1f50 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 19 Sep 2011 10:57:40 +0000 Subject: Plug a number of MarshallError memleaks. --- generic/tclIORChan.c | 12 +++++++++--- tests/ioCmd.test | 5 ----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 846618c..acf7365 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -2927,7 +2927,9 @@ ForwardProc( int written; if (Tcl_GetIntFromObj(interp, resObj, &written) != TCL_OK) { - ForwardSetObjError(paramPtr, MarshallError(interp)); + Tcl_DecrRefCount(resObj); + resObj = MarshallError(interp); + ForwardSetObjError(paramPtr, resObj); paramPtr->output.toWrite = -1; } else if (written==0 || paramPtr->output.toWriteseek.offset = newLoc; } } else { - ForwardSetObjError(paramPtr, MarshallError(interp)); + Tcl_DecrRefCount(resObj); + resObj = MarshallError(interp); + ForwardSetObjError(paramPtr, resObj); paramPtr->seek.offset = -1; } } @@ -3061,7 +3065,9 @@ ForwardProc( if (Tcl_ListObjGetElements(interp, resObj, &listc, &listv) != TCL_OK) { - ForwardSetObjError(paramPtr, MarshallError(interp)); + Tcl_DecrRefCount(resObj); + resObj = MarshallError(interp); + ForwardSetObjError(paramPtr, resObj); } else if ((listc % 2) == 1) { /* * Odd number of elements is wrong. [x]. diff --git a/tests/ioCmd.test b/tests/ioCmd.test index c46dc26..d45f7aa 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -2508,7 +2508,6 @@ test iocmd.tf-24.11 {chan write, failed write, custom return is error} -match gl } -result {{write rc* snarfsnarfsnarf} 1 *bad code*} \ -constraints {testchannel thread} test iocmd.tf-24.12 {chan write, failed write, non-numeric return is error} -match glob -body { -#LEAKS! set res {} proc foo {args} {oninit; onfinal; track; return BANG} set c [chan create {r w} foo] @@ -2583,7 +2582,6 @@ test iocmd.tf-24.15 {chan write, EAGAIN means that writing is not allowed at thi -constraints {testchannel thread} test iocmd.tf-24.16 {chan write, note the background flush setup by close due to the EAGAIN leaving data in buffers.} -match glob -setup { -#LEAKS! set res {} proc foo {args} { oninit; onfinal; track @@ -2677,7 +2675,6 @@ test iocmd.tf-25.4 {chan configure, cgetall, bad result, list of uneven length} set res } -constraints {testchannel thread} -result {{cgetall rc*} 1 {Expected list with even number of elements, got 1 element instead}} test iocmd.tf-25.5 {chan configure, cgetall, bad result, not a list} -match glob -body { -#LEAKS! set res {} proc foo {args} { oninit cget cgetall; onfinal; track @@ -3110,7 +3107,6 @@ test iocmd.tf-28.8 {chan tell, negative return} -match glob -body { } -result {{seek rc* 0 current} 1 {Tried to seek before origin}} \ -constraints {testchannel thread} test iocmd.tf-28.9 {chan tell, string return} -match glob -body { -#LEAKS! set res {} proc foo {args} {oninit seek; onfinal; track; return BOGUS} set c [chan create {r w} foo] @@ -3224,7 +3220,6 @@ test iocmd.tf-28.16 {chan seek, bogus return, negative location} -match glob -bo } -result {{seek rc* 0 start} 1 {Tried to seek before origin}} \ -constraints {testchannel thread} test iocmd.tf-28.17 {chan seek, bogus return, string return} -match glob -body { -#LEAKS! set res {} proc foo {args} {oninit seek; onfinal; track; return BOGUS} set c [chan create {r w} foo] -- cgit v0.12