aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/concat.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-19 11:01:26 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-19 11:01:26 +0200
commit20dfab33f5ab61fc51de65192ed239f8b62782a2 (patch)
treef5164b3f79ab48e4dd4c027bef968666f7748716 /libavformat/concat.c
parentf54d751f33375054d4ecf30301ef008c8e781f99 (diff)
parent5626f994f273af80fb100d4743b963304de9e05c (diff)
downloadffmpeg-20dfab33f5ab61fc51de65192ed239f8b62782a2.tar.gz
Merge commit '5626f994f273af80fb100d4743b963304de9e05c'
* commit '5626f994f273af80fb100d4743b963304de9e05c': avformat: Use av_reallocp() where suitable Conflicts: libavformat/avidec.c libavformat/avienc.c libavformat/aviobuf.c libavformat/oggparsevorbis.c libavformat/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/concat.c')
-rw-r--r--libavformat/concat.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavformat/concat.c b/libavformat/concat.c
index f97354c788..849b61a092 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;
}