diff options
author | Alexandra Khirnova <alexandra.khirnova@gmail.com> | 2013-09-18 18:12:36 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2013-09-18 18:28:38 +0200 |
commit | 5626f994f273af80fb100d4743b963304de9e05c (patch) | |
tree | 69a48a5383a83d06f8e25df3098cce219788e873 /libavformat/concat.c | |
parent | 0f310a6f333b016d336674d086045e8473fdf918 (diff) | |
download | ffmpeg-5626f994f273af80fb100d4743b963304de9e05c.tar.gz |
avformat: Use av_reallocp() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavformat/concat.c')
-rw-r--r-- | libavformat/concat.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libavformat/concat.c b/libavformat/concat.c index 24c50c1e4e..4682d8a260 100644 --- a/libavformat/concat.c +++ b/libavformat/concat.c @@ -56,7 +56,7 @@ static av_cold int concat_close(URLContext *h) static av_cold int concat_open(URLContext *h, const char *uri, int flags) { - char *node_uri = NULL, *tmp_uri; + char *node_uri = NULL; int err = 0; int64_t size; size_t len, i; @@ -85,11 +85,8 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags) for (i = 0; *uri; i++) { /* parsing uri */ len = strcspn(uri, AV_CAT_SEPARATOR); - if (!(tmp_uri = av_realloc(node_uri, len+1))) { - err = AVERROR(ENOMEM); + if ((err = av_reallocp(&node_uri, len + 1)) < 0) break; - } else - node_uri = tmp_uri; av_strlcpy(node_uri, uri, len+1); uri += len + strspn(uri+len, AV_CAT_SEPARATOR); @@ -114,10 +111,9 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags) if (err < 0) concat_close(h); - else if (!(nodes = av_realloc(nodes, data->length * sizeof(*nodes)))) { + else if ((err = av_reallocp(&nodes, data->length * sizeof(*nodes))) < 0) concat_close(h); - err = AVERROR(ENOMEM); - } else + else data->nodes = nodes; return err; } |