diff mbox series

[FFmpeg-devel,2/4] avformat/au: Remove redundant av_freep()

Message ID 20200713194211.30244-2-andreas.rheinhardt@gmail.com
State Accepted
Commit 84340497c03d34ce6902d210b8a20b848c37ce98
Headers show
Series [FFmpeg-devel,1/4] avformat/au: Store strings instead of pointers to strings in array
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt July 13, 2020, 7:42 p.m. UTC
This av_freep(&key) in conjunction with the fact that the loop condition
checks for key != NULL was equivalent to a av_freep(&key) + a break
immediately thereafter. But given that there is an av_freep(&key)
directly after the loop, the av_freep(&key) is unnecessary and the break
can also be added explicitly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/au.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/au.c b/libavformat/au.c
index b419c9ed95..c4a32ff76c 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -107,11 +107,11 @@  static int au_read_annotation(AVFormatContext *s, int size)
                     av_log(s, AV_LOG_ERROR, "Memory error while parsing AU metadata.\n");
                 } else {
                     av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED);
-                    for (i = 0; i < FF_ARRAY_ELEMS(keys) && key != NULL; i++) {
+                    for (i = 0; i < FF_ARRAY_ELEMS(keys); i++) {
                         if (av_strcasecmp(keys[i], key) == 0) {
                             av_dict_set(&(s->metadata), keys[i], value, AV_DICT_DONT_STRDUP_VAL);
-                            av_freep(&key);
                             value = NULL;
+                            break;
                         }
                     }
                 }