diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-07 22:28:59 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-07 23:02:10 +0200 |
commit | 5f8300afc6537e2e06f8f90989d5f268884bb79c (patch) | |
tree | 9050beee3ce62d506232a773542613a8b2cfd630 | |
parent | 92deb28945a5f2b58908d383f183cfc1bc1d7fae (diff) | |
download | ffmpeg-5f8300afc6537e2e06f8f90989d5f268884bb79c.tar.gz |
mpegtsenc: Check dynarray_add() for failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/mpegtsenc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 5d98ea8b7c..5c0b0d761e 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -533,14 +533,17 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts, int sid, service->pcr_pid = 0x1fff; service->provider_name = av_strdup(provider_name); service->name = av_strdup(name); - if (!service->provider_name || !service->name) { - av_freep(&service->provider_name); - av_freep(&service->name); - av_free(service); - return NULL; - } - dynarray_add(&ts->services, &ts->nb_services, service); + if (!service->provider_name || !service->name) + goto fail; + if (av_dynarray_add_nofree(&ts->services, &ts->nb_services, service) < 0) + goto fail; + return service; +fail: + av_freep(&service->provider_name); + av_freep(&service->name); + av_free(service); + return NULL; } static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb) |