OSDN Git Service

ffserver: Use av_malloc_array()
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 6 Jan 2015 16:55:50 +0000 (17:55 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Jan 2015 23:17:38 +0000 (00:17 +0100)
Reviewed-by: "Reynaldo H. Verdejo Pinochet" <reynaldo@osg.samsung.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffserver.c

index 1f20d19..0b69196 100644 (file)
@@ -2810,11 +2810,9 @@ static int prepare_sdp_description(FFServerStream *stream, uint8_t **pbuffer,
         snprintf(avc->filename, 1024, "rtp://0.0.0.0");
     }
 
-    if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) ||
-        !(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams))))
+    if (!(avc->streams = av_malloc_array(avc->nb_streams, sizeof(*avc->streams))))
         goto sdp_done;
-    if (avc->nb_streams >= INT_MAX/sizeof(*avs) ||
-        !(avs = av_malloc(avc->nb_streams * sizeof(*avs))))
+    if (!(avs = av_malloc_array(avc->nb_streams, sizeof(*avs))))
         goto sdp_done;
 
     for(i = 0; i < stream->nb_streams; i++) {