Global (Windows): fixes possible use-before-init errors

This commit is contained in:
李通洲
2026-05-06 15:00:52 +08:00
parent 79b61f1391
commit dca3b154ef
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -72,13 +72,13 @@ extern "C" const char* ffDetectCamera(FF_A_UNUSED FFlist* result) {
continue;
}
IMFStreamDescriptor* FF_AUTO_RELEASE_COM_OBJECT sd = NULL;
IMFStreamDescriptor* FF_AUTO_RELEASE_COM_OBJECT sd = nullptr;
BOOL selected;
if (FAILED(pd->GetStreamDescriptorByIndex(0, &selected, &sd))) {
continue;
}
IMFMediaTypeHandler* FF_AUTO_RELEASE_COM_OBJECT handler = NULL;
IMFMediaTypeHandler* FF_AUTO_RELEASE_COM_OBJECT handler = nullptr;
if (FAILED(sd->GetMediaTypeHandler(&handler))) {
continue;
}
+2 -2
View File
@@ -25,7 +25,7 @@ static const char* detectSoundDevice(FFlist* devices /* List of FFSoundDevice */
return "immDevice->GetId() failed";
}
IPropertyStore* FF_AUTO_RELEASE_COM_OBJECT immPropStore;
IPropertyStore* FF_AUTO_RELEASE_COM_OBJECT immPropStore = NULL;
if (FAILED(immDevice->OpenPropertyStore(STGM_READ, &immPropStore))) {
return "immDevice->OpenPropertyStore() failed";
}
@@ -54,7 +54,7 @@ static const char* detectSoundDevice(FFlist* devices /* List of FFSoundDevice */
}
}
IAudioEndpointVolume* FF_AUTO_RELEASE_COM_OBJECT immEndpointVolume;
IAudioEndpointVolume* FF_AUTO_RELEASE_COM_OBJECT immEndpointVolume = NULL;
if (SUCCEEDED(immDevice->Activate(IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (void**) &immEndpointVolume))) {
BOOL muted;
if (FAILED(immEndpointVolume->GetMute(&muted)) || !muted) {