aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ext/Firewall/ca/firewall.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/ext/Firewall/ca/firewall.cpp b/src/ext/Firewall/ca/firewall.cpp
index f50ae409..dfe8ecf1 100644
--- a/src/ext/Firewall/ca/firewall.cpp
+++ b/src/ext/Firewall/ca/firewall.cpp
@@ -464,29 +464,30 @@ static HRESULT GetFwRuleInterfaces(
464 } 464 }
465 } 465 }
466 466
467 ExitOnNull(iInterfacesCount, hr, S_OK, "All interfaces are empty values"); 467 if (iInterfacesCount > 0)
468
469 vInterfaces.vt = VT_ARRAY | VT_VARIANT;
470 // this will be cleaned up by ReleaseVariant call of the calling function
471 vInterfaces.parray = SafeArrayCreateVector(VT_VARIANT, 0, iInterfacesCount);
472
473 for (LPCWSTR pwzElement = bstrInterfaces; pwzElement < (bstrInterfaces + iLength); ++pwzElement)
474 { 468 {
475 if (*pwzElement) 469 vInterfaces.vt = VT_ARRAY | VT_VARIANT;
470 // this will be cleaned up by ReleaseVariant call of the calling function
471 vInterfaces.parray = SafeArrayCreateVector(VT_VARIANT, 0, iInterfacesCount);
472
473 for (LPCWSTR pwzElement = bstrInterfaces; pwzElement < (bstrInterfaces + iLength); ++pwzElement)
476 { 474 {
477 VARIANT vElement; 475 if (*pwzElement)
478 ::VariantInit(&vElement); 476 {
477 VARIANT vElement;
478 ::VariantInit(&vElement);
479 479
480 vElement.vt = VT_BSTR; 480 vElement.vt = VT_BSTR;
481 // this will be cleaned up by ReleaseVariant call of the calling function 481 // this will be cleaned up by ReleaseVariant call of the calling function
482 vElement.bstrVal = ::SysAllocString(pwzElement); 482 vElement.bstrVal = ::SysAllocString(pwzElement);
483 ExitOnNull(vElement.bstrVal, hr, E_OUTOFMEMORY, "failed SysAllocString for interface element"); 483 ExitOnNull(vElement.bstrVal, hr, E_OUTOFMEMORY, "failed SysAllocString for interface element");
484 484
485 hr = SafeArrayPutElement(vInterfaces.parray, &iIndex, &vElement); 485 hr = SafeArrayPutElement(vInterfaces.parray, &iIndex, &vElement);
486 ExitOnFailure(hr, "failed to put interface '%ls' into safe array", pwzElement); 486 ExitOnFailure(hr, "failed to put interface '%ls' into safe array", pwzElement);
487 487
488 pwzElement += ::SysStringLen(vElement.bstrVal); 488 pwzElement += ::SysStringLen(vElement.bstrVal);
489 iIndex++; 489 iIndex++;
490 }
490 } 491 }
491 } 492 }
492 493