Browse Source

libobs: Fix crash on encoder initialization failure

Found via clang static analysis
Palana 10 years ago
parent
commit
4ee5c8e0f3
1 changed files with 2 additions and 1 deletions
  1. 2 1
      libobs/obs-encoder.c

+ 2 - 1
libobs/obs-encoder.c

@@ -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));