aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/signature_lookup.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-02-05 12:10:41 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2024-02-12 00:50:45 +0100
commit6c504829514333439d15deb5717567fb4bdbbee0 (patch)
treeb5bfa43f3c09aacc9a4e50e3783d2940ef80a004 /libavfilter/signature_lookup.c
parent2c324fcce06171664d655ab170233a1d7f04074e (diff)
downloadffmpeg-6c504829514333439d15deb5717567fb4bdbbee0.tar.gz
avfilter/signature_lookup: dont leave uncleared pointers in sll_free()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/signature_lookup.c')
-rw-r--r--libavfilter/signature_lookup.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c
index 86dd0c6675..3c7006c9d6 100644
--- a/libavfilter/signature_lookup.c
+++ b/libavfilter/signature_lookup.c
@@ -37,6 +37,16 @@
#define STATUS_END_REACHED 1
#define STATUS_BEGIN_REACHED 2
+static void sll_free(MatchingInfo **sll)
+{
+ while (*sll) {
+ MatchingInfo *tmp = *sll;
+ *sll = tmp->next;
+ tmp->next = NULL;
+ av_free(tmp);
+ }
+}
+
static void fill_l1distlut(uint8_t lut[])
{
int i, j, tmp_i, tmp_j,count;
@@ -520,16 +530,6 @@ static MatchingInfo evaluate_parameters(AVFilterContext *ctx, SignatureContext *
return bestmatch;
}
-static void sll_free(MatchingInfo *sll)
-{
- void *tmp;
- while (sll) {
- tmp = sll;
- sll = sll->next;
- av_freep(&tmp);
- }
-}
-
static MatchingInfo lookup_signatures(AVFilterContext *ctx, SignatureContext *sc, StreamContext *first, StreamContext *second, int mode)
{
CoarseSignature *cs, *cs2;
@@ -572,7 +572,7 @@ static MatchingInfo lookup_signatures(AVFilterContext *ctx, SignatureContext *sc
"ratio %f, offset %d, score %d, %d frames matching\n",
bestmatch.first->index, bestmatch.second->index,
bestmatch.framerateratio, bestmatch.offset, bestmatch.score, bestmatch.matchframes);
- sll_free(infos);
+ sll_free(&infos);
}
} while (find_next_coarsecandidate(sc, second->coarsesiglist, &cs, &cs2, 0) && !bestmatch.whole);
return bestmatch;