summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-11-27 10:50:47 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-12-03 16:07:02 +0100
commita4798a5d5109cd9c1b5682efe19660e825da97e6 (patch)
treec91e38e738cf12d468e06aaba77738173eed75e1 /libavutil
parentb574fb472ed168f5a75cd981c98dd34cfe57ff3a (diff)
all: Use av_memdup() where appropriate
Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/bprint.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index a6849d7178..ea51d9b09c 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -244,10 +244,8 @@ int av_bprint_finalize(AVBPrint *buf, char **ret_str)
str = buf->str;
buf->str = NULL;
} else {
- str = av_malloc(real_size);
- if (str)
- memcpy(str, buf->str, real_size);
- else
+ str = av_memdup(buf->str, real_size);
+ if (!str)
ret = AVERROR(ENOMEM);
}
*ret_str = str;