mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Merge pull request #404 from Palakis/bugfix/memory-leaks
Fix memory leaks in GetCurrentProfile, GetCurrentSceneCollection and Heartbeat event
This commit is contained in:
commit
d78ed32df5
@ -857,7 +857,9 @@ void WSEvents::Heartbeat() {
|
||||
pulse = !pulse;
|
||||
obs_data_set_bool(data, "pulse", pulse);
|
||||
|
||||
obs_data_set_string(data, "current-profile", obs_frontend_get_current_profile());
|
||||
char* currentProfile = obs_frontend_get_current_profile();
|
||||
obs_data_set_string(data, "current-profile", currentProfile);
|
||||
bfree(currentProfile);
|
||||
|
||||
OBSSourceAutoRelease currentScene = obs_frontend_get_current_scene();
|
||||
obs_data_set_string(data, "current-scene", obs_source_get_name(currentScene));
|
||||
|
@ -39,7 +39,9 @@ HandlerResponse WSRequestHandler::HandleSetCurrentProfile(WSRequestHandler* req)
|
||||
*/
|
||||
HandlerResponse WSRequestHandler::HandleGetCurrentProfile(WSRequestHandler* req) {
|
||||
OBSDataAutoRelease response = obs_data_create();
|
||||
obs_data_set_string(response, "profile-name", obs_frontend_get_current_profile());
|
||||
char* currentProfile = obs_frontend_get_current_profile();
|
||||
obs_data_set_string(response, "profile-name", currentProfile);
|
||||
bfree(currentProfile);
|
||||
return req->SendOKResponse(response);
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,10 @@ HandlerResponse WSRequestHandler::HandleSetCurrentSceneCollection(WSRequestHandl
|
||||
*/
|
||||
HandlerResponse WSRequestHandler::HandleGetCurrentSceneCollection(WSRequestHandler* req) {
|
||||
OBSDataAutoRelease response = obs_data_create();
|
||||
obs_data_set_string(response, "sc-name",
|
||||
obs_frontend_get_current_scene_collection());
|
||||
|
||||
char* sceneCollection = obs_frontend_get_current_scene_collection();
|
||||
obs_data_set_string(response, "sc-name", sceneCollection);
|
||||
bfree(sceneCollection);
|
||||
|
||||
return req->SendOKResponse(response);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user