mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 17:11:40 -05:00
fix possible mem leak if loading a MIDI binding fails
This commit is contained in:
parent
bc440df955
commit
7f57f1d450
1 changed files with 3 additions and 2 deletions
|
@ -784,10 +784,10 @@ Binding* GenericMIDI::setupBinding( cJSON* binding )
|
||||||
// create binding, then fill in data as from JSON.
|
// create binding, then fill in data as from JSON.
|
||||||
Binding* tmp = new Binding();
|
Binding* tmp = new Binding();
|
||||||
|
|
||||||
|
|
||||||
cJSON* actionJson = cJSON_GetObjectItem( binding, "action" );
|
cJSON* actionJson = cJSON_GetObjectItem( binding, "action" );
|
||||||
if ( !actionJson ) {
|
if ( !actionJson ) {
|
||||||
LUPPP_WARN("Binding doesn't have action field: fix .ctlr file");
|
LUPPP_WARN("Binding doesn't have action field: fix .ctlr file");
|
||||||
|
delete tmp;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -795,6 +795,7 @@ Binding* GenericMIDI::setupBinding( cJSON* binding )
|
||||||
cJSON* dataJson = cJSON_GetObjectItem( binding, "data" );
|
cJSON* dataJson = cJSON_GetObjectItem( binding, "data" );
|
||||||
if ( !statusJson || !dataJson ) {
|
if ( !statusJson || !dataJson ) {
|
||||||
LUPPP_WARN("Binding w Action:%s doesn't have status / data field: fix .ctlr file", actionJson->valuestring);
|
LUPPP_WARN("Binding w Action:%s doesn't have status / data field: fix .ctlr file", actionJson->valuestring);
|
||||||
|
delete tmp;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -889,8 +890,8 @@ Binding* GenericMIDI::setupBinding( cJSON* binding )
|
||||||
LUPPP_WARN("Binding action not recognized: %s", actionJson->valuestring );
|
LUPPP_WARN("Binding action not recognized: %s", actionJson->valuestring );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete tmp;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue