request handler: fix obs_data_item_t memory leak

This commit is contained in:
Stéphane Lepin
2019-08-31 02:52:08 +02:00
parent 6041c4acd2
commit 71f792944c
3 changed files with 11 additions and 1 deletions

View File

@ -231,7 +231,7 @@ bool WSRequestHandler::hasField(QString name, obs_data_type expectedFieldType, o
return false;
}
obs_data_item_t* dataItem = obs_data_item_byname(data, name.toUtf8());
OBSDataItemAutoRelease dataItem = obs_data_item_byname(data, name.toUtf8());
if (!dataItem) {
return false;
}

View File

@ -35,6 +35,11 @@ void ___data_dummy_addref(obs_data_t*) {}
void ___data_array_dummy_addref(obs_data_array_t*) {}
void ___output_dummy_addref(obs_output_t*) {}
void ___data_item_dummy_addref(obs_data_item_t*) {}
void ___data_item_release(obs_data_item_t* dataItem) {
obs_data_item_release(&dataItem);
}
OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("obs-websocket", "en-US")

View File

@ -38,6 +38,11 @@ using OBSDataArrayAutoRelease =
using OBSOutputAutoRelease =
OBSRef<obs_output_t*, ___output_dummy_addref, obs_output_release>;
void ___data_item_dummy_addref(obs_data_item_t*);
void ___data_item_release(obs_data_item_t*);
using OBSDataItemAutoRelease =
OBSRef<obs_data_item_t*, ___data_item_dummy_addref, ___data_item_release>;
class Config;
typedef std::shared_ptr<Config> ConfigPtr;