[vlc-commits] sap: revector, use return value

Rémi Denis-Courmont git at videolan.org
Fri Apr 10 15:06:56 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 10 14:03:52 2020 +0300| [ea8d67cc900c98291ae9de18b817b298f8b00f90] | committer: Rémi Denis-Courmont

sap: revector, use return value

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ea8d67cc900c98291ae9de18b817b298f8b00f90
---

 modules/services_discovery/sap.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 95b8551eff..3deffd0291 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -793,7 +793,11 @@ static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf,
         }
     }
 
-    CreateAnnounce( p_sd, i_source, i_hash, p_sdp, uri );
+    sap_announce_t *sap = CreateAnnounce(p_sd, i_source, i_hash, p_sdp, uri);
+
+    if (sap != NULL)
+        TAB_APPEND(p_sys->i_announces, p_sys->pp_announces, sap);
+
     free(uri);
     free (decomp);
     return VLC_SUCCESS;
@@ -809,12 +813,9 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint32_t *i_source,
     const char *psz_value;
     sap_announce_t *p_sap = (sap_announce_t *)malloc(
                                         sizeof(sap_announce_t ) );
-    services_discovery_sys_t *p_sys;
     if( p_sap == NULL )
         return NULL;
 
-    p_sys = p_sd->p_sys;
-
     p_sap->i_last = vlc_tick_now();
     p_sap->i_period = 0;
     p_sap->i_period_trust = 0;
@@ -882,8 +883,6 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint32_t *i_source,
         services_discovery_AddItemCat(p_sd, p_input, psz_value);
     }
 
-    TAB_APPEND( p_sys->i_announces, p_sys->pp_announces, p_sap );
-
     return p_sap;
 }
 



More information about the vlc-commits mailing list