Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer authored on 2013/12/13 23:13:01... | ... |
@@ -126,6 +126,22 @@ static int alloc_metrics(PullupContext *s, PullupField *f) |
126 | 126 |
return 0; |
127 | 127 |
} |
128 | 128 |
|
129 |
+static void free_field_queue(PullupField *head, PullupField **last) |
|
130 |
+{ |
|
131 |
+ PullupField *f = head; |
|
132 |
+ while (f) { |
|
133 |
+ av_free(f->diffs); |
|
134 |
+ av_free(f->combs); |
|
135 |
+ av_free(f->vars); |
|
136 |
+ if (f == *last) { |
|
137 |
+ av_freep(last); |
|
138 |
+ break; |
|
139 |
+ } |
|
140 |
+ f = f->next; |
|
141 |
+ av_freep(&f->prev); |
|
142 |
+ }; |
|
143 |
+} |
|
144 |
+ |
|
129 | 145 |
static PullupField *make_field_queue(PullupContext *s, int len) |
130 | 146 |
{ |
131 | 147 |
PullupField *head, *f; |
... | ... |
@@ -714,21 +730,9 @@ end: |
714 | 714 |
static av_cold void uninit(AVFilterContext *ctx) |
715 | 715 |
{ |
716 | 716 |
PullupContext *s = ctx->priv; |
717 |
- PullupField *f; |
|
718 | 717 |
int i; |
719 | 718 |
|
720 |
- f = s->head; |
|
721 |
- while (f) { |
|
722 |
- av_free(f->diffs); |
|
723 |
- av_free(f->combs); |
|
724 |
- av_free(f->vars); |
|
725 |
- if (f == s->last) { |
|
726 |
- av_freep(&s->last); |
|
727 |
- break; |
|
728 |
- } |
|
729 |
- f = f->next; |
|
730 |
- av_freep(&f->prev); |
|
731 |
- }; |
|
719 |
+ free_field_queue(s->head, &s->last); |
|
732 | 720 |
|
733 | 721 |
for (i = 0; i < FF_ARRAY_ELEMS(s->buffers); i++) { |
734 | 722 |
av_freep(&s->buffers[i].planes[0]); |