Explorar el Código

obs-vst: Fix memory leaks on macOS when VST's fail to load

Detected by clang-analyzer.
gxalpha hace 2 años
padre
commit
9c6a3a1d49
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      plugins/obs-vst/mac/VSTPlugin-osx.mm

+ 5 - 0
plugins/obs-vst/mac/VSTPlugin-osx.mm

@@ -30,6 +30,7 @@ AEffect *VSTPlugin::loadEffect()
 							   true);
 
 	if (bundleUrl == NULL) {
+		CFRelease(pluginPathStringRef);
 		blog(LOG_WARNING,
 		     "Couldn't make URL reference for VST plug-in");
 		return NULL;
@@ -58,6 +59,8 @@ AEffect *VSTPlugin::loadEffect()
 
 	if (mainEntryPoint == NULL) {
 		blog(LOG_WARNING, "Couldn't get a pointer to plug-in's main()");
+		CFRelease(pluginPathStringRef);
+		CFRelease(bundleUrl);
 		CFRelease(bundle);
 		bundle = NULL;
 		return NULL;
@@ -66,6 +69,8 @@ AEffect *VSTPlugin::loadEffect()
 	newEffect = mainEntryPoint(hostCallback_static);
 	if (newEffect == NULL) {
 		blog(LOG_WARNING, "VST Plug-in's main() returns null.");
+		CFRelease(pluginPathStringRef);
+		CFRelease(bundleUrl);
 		CFRelease(bundle);
 		bundle = NULL;
 		return NULL;