]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/af_mcompand: check allocation results
authorMarton Balint <cus@passwd.hu>
Sat, 10 Apr 2021 10:03:17 +0000 (12:03 +0200)
committerMarton Balint <cus@passwd.hu>
Sun, 18 Apr 2021 15:25:51 +0000 (17:25 +0200)
Fixes the only remaining part of ticket #8931.

Signed-off-by: Marton Balint <cus@passwd.hu>
libavfilter/af_mcompand.c

index ce4f366ad736d57409a7910380e5e90b13168ac7..d1a3dc123a7bde0ff0965dc7014bd468989a0544 100644 (file)
@@ -384,6 +384,9 @@ static int config_output(AVFilterLink *outlink)
         s->bands[i].attack_rate = av_calloc(outlink->channels, sizeof(double));
         s->bands[i].decay_rate = av_calloc(outlink->channels, sizeof(double));
         s->bands[i].volume = av_calloc(outlink->channels, sizeof(double));
+        if (!s->bands[i].attack_rate || !s->bands[i].decay_rate || !s->bands[i].volume)
+            return AVERROR(ENOMEM);
+
         for (k = 0; k < FFMIN(nb_attacks / 2, outlink->channels); k++) {
             char *tstr3 = av_strtok(p3, ",", &saveptr3);