diff --git a/src/requesthandler/rpc/Request.cpp b/src/requesthandler/rpc/Request.cpp index a7ba940f4..b5f9d8a0d 100644 --- a/src/requesthandler/rpc/Request.cpp +++ b/src/requesthandler/rpc/Request.cpp @@ -143,7 +143,7 @@ obs_source_t *Request::ValidateScene(const std::string keyName, RequestStatus::R std::string sceneName = RequestData[keyName]; - OBSSourceAutoRelease ret = obs_get_source_by_name(sceneName.c_str()); + obs_source_t *ret = obs_get_source_by_name(sceneName.c_str()); if (!ret) { statusCode = RequestStatus::ResourceNotFound; comment = std::string("No scene was found by the name of `") + sceneName + "`."; @@ -151,6 +151,7 @@ obs_source_t *Request::ValidateScene(const std::string keyName, RequestStatus::R } if (obs_source_get_type(ret) != OBS_SOURCE_TYPE_SCENE) { + obs_source_release(ret); statusCode = RequestStatus::InvalidResourceType; comment = "The specified source is not a scene."; return nullptr; @@ -158,12 +159,12 @@ obs_source_t *Request::ValidateScene(const std::string keyName, RequestStatus::R OBSScene scene = obs_scene_from_source(ret); if (obs_scene_is_group(scene)) { + obs_source_release(ret); statusCode = RequestStatus::InvalidResourceType; comment = "The specified source is not a scene."; return nullptr; } - obs_source_addref(ret); return ret; }