libobs: Fix crash on encoder initialization failure

Found via clang static analysis
This commit is contained in:
Palana
2015-06-01 01:37:36 +02:00
parent c680b3e115
commit 4ee5c8e0f3

View File

@@ -73,8 +73,9 @@ static struct obs_encoder *create_encoder(const char *id,
success = init_encoder(encoder, name, settings, hotkey_data);
if (!success) {
blog(LOG_ERROR, "creating encoder '%s' (%s) failed", name, id);
obs_encoder_destroy(encoder);
encoder = NULL;
return NULL;
}
encoder->control = bzalloc(sizeof(obs_weak_encoder_t));