This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit ef76da316d7a90bac3c8db92389aa59e9c864cfe
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Fri Aug 14 22:40:52 2026 +0200
Commit:     Jack Lau <[email protected]>
CommitDate: Sat Aug 15 08:14:15 2026 +0000

    avformat/whip: Avoid calling strlen multiple times
    
    Also avoid zeroing the buffer unnecessarily, ff_data_to_hex()
    also initialized it (including the terminating \0).
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavformat/whip.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/whip.c b/libavformat/whip.c
index ae2c116a4d..a845f0c37c 100644
--- a/libavformat/whip.c
+++ b/libavformat/whip.c
@@ -791,7 +791,7 @@ static int exchange_sdp(AVFormatContext *s)
         goto end;
     }
 
-    if (!whip->sdp_offer || !strlen(whip->sdp_offer)) {
+    if (!whip->sdp_offer || !*whip->sdp_offer) {
         av_log(whip, AV_LOG_ERROR, "No offer to exchange\n");
         ret = AVERROR(EINVAL);
         goto end;
@@ -812,12 +812,13 @@ static int exchange_sdp(AVFormatContext *s)
     if (whip->timeout >= 0)
         av_dict_set_int(&opts, "timeout", whip->timeout, 0);
 
-    hex_data = av_mallocz(2 * strlen(whip->sdp_offer) + 1);
+    const size_t sdp_offer_len = strlen(whip->sdp_offer);
+    hex_data = av_malloc(2 * sdp_offer_len + 1);
     if (!hex_data) {
         ret = AVERROR(ENOMEM);
         goto end;
     }
-    ff_data_to_hex(hex_data, whip->sdp_offer, strlen(whip->sdp_offer), 0);
+    ff_data_to_hex(hex_data, whip->sdp_offer, sdp_offer_len, 0);
     av_dict_set(&opts, "post_data", hex_data, 0);
 
     ret = ffurl_open_whitelist(&whip_uc, s->url, AVIO_FLAG_READ_WRITE, 
&s->interrupt_callback,

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to