ticket 8931 mentions some missing null pointer checks and so this is one
diff of a few which are for these fixes. There are previous code pieces
which return ENOMEM, so this should work as intended.
---
 libavfilter/af_mcompand.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavfilter/af_mcompand.c b/libavfilter/af_mcompand.c
index f142573bea..953f7cd407 100644
--- a/libavfilter/af_mcompand.c
+++ b/libavfilter/af_mcompand.c
@@ -386,8 +386,20 @@ static int config_output(AVFilterLink *outlink)
         }
 
         s->bands[i].attack_rate = av_calloc(outlink->channels, sizeof(double));
+        if (!s->bands[i].attack_rate) {
+            av_log(ctx, AV_LOG_ERROR, "Could not allocate memory for the 
attack_rate\n");
+            return AVERROR(ENOMEM);
+        }
         s->bands[i].decay_rate = av_calloc(outlink->channels, sizeof(double));
+        if (!s->bands[i].decay_rate) {
+            av_log(ctx, AV_LOG_ERROR, "Could not allocate memory for the 
decay_rate\n");
+            return AVERROR(ENOMEM);
+        }
         s->bands[i].volume = av_calloc(outlink->channels, sizeof(double));
+        if (!s->bands[i].volume) {
+            av_log(ctx, AV_LOG_ERROR, "Could not allocate memory for the 
volume\n");
+            return AVERROR(ENOMEM);
+        }
         for (k = 0; k < FFMIN(nb_attacks / 2, outlink->channels); k++) {
             char *tstr3 = av_strtok(p3, ",", &saveptr3);
 
-- 
2.28.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to