Skip to content

Commit c3c57bb

Browse files
authored
Fix possible COM leak (#5522)
1 parent 7d70948 commit c3c57bb

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/SOS/Strike/strike.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11278,7 +11278,6 @@ class ClrStackImpl
1127811278
static void PrintArgsAndLocals(IXCLRDataStackWalk *pStackWalk, BOOL bArgs, BOOL bLocals)
1127911279
{
1128011280
ToRelease<IXCLRDataFrame> pFrame;
11281-
ToRelease<IXCLRDataValue> pVal;
1128211281
ULONG32 argCount = 0;
1128311282
ULONG32 localCount = 0;
1128411283
HRESULT hr = S_OK;
@@ -11290,14 +11289,14 @@ class ClrStackImpl
1129011289
hr = pFrame->GetNumArguments(&argCount);
1129111290

1129211291
if (SUCCEEDED(hr) && bArgs)
11293-
hr = ShowArgs(argCount, pFrame, pVal);
11292+
hr = ShowArgs(argCount, pFrame);
1129411293

1129511294
// Print locals
1129611295
if (SUCCEEDED(hr) && bLocals)
1129711296
hr = pFrame->GetNumLocalVariables(&localCount);
1129811297

1129911298
if (SUCCEEDED(hr) && bLocals)
11300-
ShowLocals(localCount, pFrame, pVal);
11299+
ShowLocals(localCount, pFrame);
1130111300

1130211301
ExtOut("\n");
1130311302
}
@@ -11308,9 +11307,8 @@ class ClrStackImpl
1130811307
* Params:
1130911308
* argy - the number of arguments the function has
1131011309
* pFramey - the frame we are inspecting
11311-
* pVal - a pointer to the CLRDataValue we use to query for info about the args
1131211310
*/
11313-
static HRESULT ShowArgs(ULONG32 argy, IXCLRDataFrame *pFramey, IXCLRDataValue *pVal)
11311+
static HRESULT ShowArgs(ULONG32 argy, IXCLRDataFrame *pFramey)
1131411312
{
1131511313
CLRDATA_ADDRESS addr = 0;
1131611314
BOOL fPrintedLocation = FALSE;
@@ -11332,6 +11330,7 @@ class ClrStackImpl
1133211330
ExtOut(" PARAMETERS:\n");
1133311331
}
1133411332

11333+
ToRelease<IXCLRDataValue> pVal;
1133511334
hr = pFramey->GetArgumentByIndex(i,
1133611335
&pVal,
1133711336
mdNameLen,
@@ -11413,8 +11412,6 @@ class ClrStackImpl
1141311412
{
1141411413
ExtOut("<no data>\n");
1141511414
}
11416-
11417-
pVal->Release();
1141811415
}
1141911416

1142011417
return S_OK;
@@ -11425,9 +11422,8 @@ class ClrStackImpl
1142511422
* Params:
1142611423
* localy - the number of locals in the frame
1142711424
* pFramey - the frame we are inspecting
11428-
* pVal - a pointer to the CLRDataValue we use to query for info about the args
1142911425
*/
11430-
static HRESULT ShowLocals(ULONG32 localy, IXCLRDataFrame *pFramey, IXCLRDataValue *pVal)
11426+
static HRESULT ShowLocals(ULONG32 localy, IXCLRDataFrame *pFramey)
1143111427
{
1143211428
for (ULONG32 i=0; i < localy; i++)
1143311429
{
@@ -11438,6 +11434,7 @@ class ClrStackImpl
1143811434
ExtOut(" ");
1143911435

1144011436
// local names don't work in Whidbey.
11437+
ToRelease<IXCLRDataValue> pVal;
1144111438
hr = pFramey->GetLocalVariableByIndex(i, &pVal, mdNameLen, NULL, g_mdName);
1144211439
if (FAILED(hr))
1144311440
{
@@ -11506,8 +11503,6 @@ class ClrStackImpl
1150611503
{
1150711504
ExtOut("<no data>\n");
1150811505
}
11509-
11510-
pVal->Release();
1151111506
}
1151211507

1151311508
return S_OK;

0 commit comments

Comments
 (0)