diff --git a/deps/libff/libff/ff-decoder.c b/deps/libff/libff/ff-decoder.c index a0e40881b..6e9d05d03 100644 --- a/deps/libff/libff/ff-decoder.c +++ b/deps/libff/libff/ff-decoder.c @@ -178,7 +178,7 @@ void ff_decoder_refresh(void *opaque) struct ff_frame *frame; - if (decoder && decoder->stream) { + if (decoder->stream) { if (decoder->frame_queue.size == 0) { if (!decoder->eof || !decoder->finished) { // We expected a frame, but there were none diff --git a/libobs-opengl/gl-subsystem.c b/libobs-opengl/gl-subsystem.c index 0d637cb2a..32b99f0f0 100644 --- a/libobs-opengl/gl-subsystem.c +++ b/libobs-opengl/gl-subsystem.c @@ -455,7 +455,7 @@ void device_load_texture(gs_device_t *device, gs_texture_t *tex, int unit) /* need a pixel shader to properly bind textures */ if (!device->cur_pixel_shader) - tex = NULL; + goto fail; if (cur_tex == tex) return; diff --git a/libobs/callback/decl.h b/libobs/callback/decl.h index 9dc02954b..1e955dc52 100644 --- a/libobs/callback/decl.h +++ b/libobs/callback/decl.h @@ -31,7 +31,7 @@ struct decl_param { static inline void decl_param_free(struct decl_param *param) { - if (param) + if (param->name) bfree(param->name); memset(param, 0, sizeof(struct decl_param)); } diff --git a/libobs/obs-display.c b/libobs/obs-display.c index fb5827920..f5d01abc6 100644 --- a/libobs/obs-display.c +++ b/libobs/obs-display.c @@ -149,7 +149,7 @@ static inline void render_display_begin(struct obs_display *display, { struct vec4 clear_color; - gs_load_swapchain(display ? display->swap : NULL); + gs_load_swapchain(display->swap); if (size_changed) gs_resize(cx, cy); diff --git a/libobs/obs-properties.c b/libobs/obs-properties.c index 1533bee5f..6f6b2fc66 100644 --- a/libobs/obs-properties.c +++ b/libobs/obs-properties.c @@ -551,7 +551,7 @@ static inline struct list_data *get_list_fmt_data(struct obs_property *p, enum obs_combo_format format) { struct list_data *data = get_list_data(p); - return (data->format == format) ? data : NULL; + return (data && data->format == format) ? data : NULL; } /* ------------------------------------------------------------------------- */ diff --git a/libobs/obs-scene.c b/libobs/obs-scene.c index 06dafadfa..13268d7f7 100644 --- a/libobs/obs-scene.c +++ b/libobs/obs-scene.c @@ -1395,8 +1395,7 @@ void obs_sceneitem_remove(obs_sceneitem_t *item) scene = item->parent; - if (scene) - full_lock(scene); + full_lock(scene); if (item->removed) { if (scene) diff --git a/libobs/obs-source.c b/libobs/obs-source.c index 11f3cc8f1..4b3539a23 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -1884,10 +1884,9 @@ void obs_source_filter_add(obs_source_t *source, obs_source_t *filter) signal_handler_signal(source->context.signals, "filter_add", &cd); - if (source && filter) - blog(LOG_DEBUG, "- filter '%s' (%s) added to source '%s'", - filter->context.name, filter->info.id, - source->context.name); + blog(LOG_DEBUG, "- filter '%s' (%s) added to source '%s'", + filter->context.name, filter->info.id, + source->context.name); } static bool obs_source_filter_remove_refless(obs_source_t *source, @@ -1920,10 +1919,9 @@ static bool obs_source_filter_remove_refless(obs_source_t *source, signal_handler_signal(source->context.signals, "filter_remove", &cd); - if (source && filter) - blog(LOG_DEBUG, "- filter '%s' (%s) removed from source '%s'", - filter->context.name, filter->info.id, - source->context.name); + blog(LOG_DEBUG, "- filter '%s' (%s) removed from source '%s'", + filter->context.name, filter->info.id, + source->context.name); if (filter->info.filter_remove) filter->info.filter_remove(filter->context.data, diff --git a/libobs/obs.c b/libobs/obs.c index 53e2fefc1..d4f27342e 100644 --- a/libobs/obs.c +++ b/libobs/obs.c @@ -927,11 +927,6 @@ int obs_reset_video(struct obs_video_info *ovi) stop_video(); obs_free_video(); - if (!ovi) { - obs_free_graphics(); - return OBS_VIDEO_SUCCESS; - } - /* align to multiple-of-two and SSE alignment sizes */ ovi->output_width &= 0xFFFFFFFC; ovi->output_height &= 0xFFFFFFFE; diff --git a/plugins/obs-outputs/flv-output.c b/plugins/obs-outputs/flv-output.c index a32381d6b..8f191b09c 100644 --- a/plugins/obs-outputs/flv-output.c +++ b/plugins/obs-outputs/flv-output.c @@ -73,11 +73,12 @@ static void flv_output_stop(void *data, uint64_t ts) struct flv_output *stream = data; if (stream->active) { - if (stream->file) + if (stream->file) { write_file_info(stream->file, stream->last_packet_ts, os_ftelli64(stream->file)); - fclose(stream->file); + fclose(stream->file); + } obs_output_end_data_capture(stream->output); stream->active = false; stream->sent_headers = false; diff --git a/plugins/obs-outputs/rtmp-stream.c b/plugins/obs-outputs/rtmp-stream.c index d873b64aa..0fd9db96f 100644 --- a/plugins/obs-outputs/rtmp-stream.c +++ b/plugins/obs-outputs/rtmp-stream.c @@ -95,25 +95,23 @@ static void rtmp_stream_destroy(void *data) if (stream->socket_thread_active) pthread_join(stream->socket_thread, NULL); - if (stream) { - free_packets(stream); - dstr_free(&stream->path); - dstr_free(&stream->key); - dstr_free(&stream->username); - dstr_free(&stream->password); - dstr_free(&stream->encoder_name); - dstr_free(&stream->bind_ip); - os_event_destroy(stream->stop_event); - os_sem_destroy(stream->send_sem); - pthread_mutex_destroy(&stream->packets_mutex); - circlebuf_free(&stream->packets); + free_packets(stream); + dstr_free(&stream->path); + dstr_free(&stream->key); + dstr_free(&stream->username); + dstr_free(&stream->password); + dstr_free(&stream->encoder_name); + dstr_free(&stream->bind_ip); + os_event_destroy(stream->stop_event); + os_sem_destroy(stream->send_sem); + pthread_mutex_destroy(&stream->packets_mutex); + circlebuf_free(&stream->packets); #ifdef TEST_FRAMEDROPS - circlebuf_free(&stream->droptest_info); + circlebuf_free(&stream->droptest_info); #endif - if (stream->write_buf) - bfree(stream->write_buf); - bfree(stream); - } + if (stream->write_buf) + bfree(stream->write_buf); + bfree(stream); } static void *rtmp_stream_create(obs_data_t *settings, obs_output_t *output)