]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
streaming: msg_free - allow NULL ptr as input
authorJaroslav Kysela <perex@perex.cz>
Fri, 24 Oct 2014 16:03:28 +0000 (18:03 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 24 Oct 2014 16:03:28 +0000 (18:03 +0200)
src/streaming.c
src/subscriptions.c

index 9204689f69cb6693643461ed7e77ea4a49aaf61f..4832c03d81c07167707f9290a325f225ad834765 100644 (file)
@@ -272,6 +272,9 @@ streaming_start_unref(streaming_start_t *ss)
 void
 streaming_msg_free(streaming_message_t *sm)
 {
+  if (!sm)
+    return;
+
   switch(sm->sm_type) {
   case SMT_PACKET:
     if(sm->sm_data)
index 23ee942f65040149d892458b183aa8e918b426a2..9fef32e9b67999f33a341a4ca9dc361c26adf95a 100644 (file)
@@ -79,8 +79,7 @@ subscription_link_service(th_subscription_t *s, service_t *t)
 
   if(TAILQ_FIRST(&t->s_filt_components) != NULL) {
 
-    if(s->ths_start_message != NULL)
-      streaming_msg_free(s->ths_start_message);
+    streaming_msg_free(s->ths_start_message);
 
     s->ths_start_message =
       streaming_msg_create_data(SMT_START, service_build_stream_start(t));
@@ -459,8 +458,7 @@ subscription_input(void *opauqe, streaming_message_t *sm)
     }
 
     if(sm->sm_type == SMT_START) {
-      if(s->ths_start_message != NULL) 
-        streaming_msg_free(s->ths_start_message);
+      streaming_msg_free(s->ths_start_message);
       s->ths_start_message = sm;
       return;
     }
@@ -552,8 +550,7 @@ subscription_unsubscribe(th_subscription_t *s)
     mpegts_mux_remove_subscriber(s->ths_mmi->mmi_mux, s, SM_CODE_OK);
 #endif
 
-  if(s->ths_start_message != NULL) 
-    streaming_msg_free(s->ths_start_message);
+  streaming_msg_free(s->ths_start_message);
 
   if(s->ths_output->st_cb == subscription_input_null)
    free(s->ths_output);