uninit is already called automatically (even when configuring the filter failed).
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -361,10 +361,8 @@ static int config_output(AVFilterLink *outlink) · 360 unmodified lines | |||
| 361 | char *p2, *p3, *saveptr2 = NULL, *saveptr3 = NULL; | 361 | char *p2, *p3, *saveptr2 = NULL, *saveptr3 = NULL; |
| 362 | double radius; | 362 | double radius; |
| 363 | 363 | ||
| 364 | if (!tstr) { | 364 | if (!tstr) |
| 365 | uninit(ctx); | ||
| 366 | return AVERROR(EINVAL); | 365 | return AVERROR(EINVAL); |
| 367 | } | ||
| 368 | p = NULL; | 366 | p = NULL; |
| 369 | 367 | ||
| 370 | p2 = tstr; | 368 | p2 = tstr; |
| @@ -372,7 +370,6 @@ static int config_output(AVFilterLink *outlink) · 1 unmodified line | |||
| 372 | tstr2 = av_strtok(p2, " ", &saveptr2); | 370 | tstr2 = av_strtok(p2, " ", &saveptr2); |
| 373 | if (!tstr2) { | 371 | if (!tstr2) { |
| 374 | av_log(ctx, AV_LOG_ERROR, "at least one attacks/decays rate is mandatory\n"); | 372 | av_log(ctx, AV_LOG_ERROR, "at least one attacks/decays rate is mandatory\n"); |
| 375 | uninit(ctx); | ||
| 376 | return AVERROR(EINVAL); | 373 | return AVERROR(EINVAL); |
| 377 | } | 374 | } |
| 378 | p2 = NULL; | 375 | p2 = NULL; |
| @@ -381,7 +378,6 @@ static int config_output(AVFilterLink *outlink) · 2 unmodified lines | |||
| 381 | count_items(tstr2, &nb_attacks, ','); | 378 | count_items(tstr2, &nb_attacks, ','); |
| 382 | if (!nb_attacks || nb_attacks & 1) { | 379 | if (!nb_attacks || nb_attacks & 1) { |
| 383 | av_log(ctx, AV_LOG_ERROR, "number of attacks rate plus decays rate must be even\n"); | 380 | av_log(ctx, AV_LOG_ERROR, "number of attacks rate plus decays rate must be even\n"); |
| 384 | uninit(ctx); | ||
| 385 | return AVERROR(EINVAL); | 381 | return AVERROR(EINVAL); |
| 386 | } | 382 | } |
| 387 | 383 | ||
| @@ -417,7 +413,6 @@ static int config_output(AVFilterLink *outlink) · 29 unmodified lines | |||
| 417 | tstr2 = av_strtok(p2, " ", &saveptr2); | 413 | tstr2 = av_strtok(p2, " ", &saveptr2); |
| 418 | if (!tstr2) { | 414 | if (!tstr2) { |
| 419 | av_log(ctx, AV_LOG_ERROR, "transfer function curve in dB must be set\n"); | 415 | av_log(ctx, AV_LOG_ERROR, "transfer function curve in dB must be set\n"); |
| 420 | uninit(ctx); | ||
| 421 | return AVERROR(EINVAL); | 416 | return AVERROR(EINVAL); |
| 422 | } | 417 | } |
| 423 | sscanf(tstr2, "%lf", &s->bands[i].transfer_fn.curve_dB); | 418 | sscanf(tstr2, "%lf", &s->bands[i].transfer_fn.curve_dB); |
| @@ -427,7 +422,6 @@ static int config_output(AVFilterLink *outlink) · 3 unmodified lines | |||
| 427 | tstr2 = av_strtok(p2, " ", &saveptr2); | 422 | tstr2 = av_strtok(p2, " ", &saveptr2); |
| 428 | if (!tstr2) { | 423 | if (!tstr2) { |
| 429 | av_log(ctx, AV_LOG_ERROR, "transfer points missing\n"); | 424 | av_log(ctx, AV_LOG_ERROR, "transfer points missing\n"); |
| 430 | uninit(ctx); | ||
| 431 | return AVERROR(EINVAL); | 425 | return AVERROR(EINVAL); |
| 432 | } | 426 | } |
| 433 | 427 | ||
| @@ -435,38 +429,31 @@ static int config_output(AVFilterLink *outlink) · 1 unmodified line | |||
| 435 | s->bands[i].transfer_fn.nb_segments = (nb_points + 4) * 2; | 429 | s->bands[i].transfer_fn.nb_segments = (nb_points + 4) * 2; |
| 436 | s->bands[i].transfer_fn.segments = av_calloc(s->bands[i].transfer_fn.nb_segments, | 430 | s->bands[i].transfer_fn.segments = av_calloc(s->bands[i].transfer_fn.nb_segments, |
| 437 | sizeof(CompandSegment)); | 431 | sizeof(CompandSegment)); |
| 438 | if (!s->bands[i].transfer_fn.segments) { | 432 | if (!s->bands[i].transfer_fn.segments) |
| 439 | uninit(ctx); | ||
| 440 | return AVERROR(ENOMEM); | 433 | return AVERROR(ENOMEM); |
| 441 | } | ||
| 442 | 434 | ||
| 443 | ret = parse_points(tstr2, nb_points, radius, &s->bands[i].transfer_fn, ctx); | 435 | ret = parse_points(tstr2, nb_points, radius, &s->bands[i].transfer_fn, ctx); |
| 444 | if (ret < 0) { | 436 | if (ret < 0) { |
| 445 | av_log(ctx, AV_LOG_ERROR, "transfer points parsing failed\n"); | 437 | av_log(ctx, AV_LOG_ERROR, "transfer points parsing failed\n"); |
| 446 | uninit(ctx); | ||
| 447 | return ret; | 438 | return ret; |
| 448 | } | 439 | } |
| 449 | 440 | ||
| 450 | tstr2 = av_strtok(p2, " ", &saveptr2); | 441 | tstr2 = av_strtok(p2, " ", &saveptr2); |
| 451 | if (!tstr2) { | 442 | if (!tstr2) { |
| 452 | av_log(ctx, AV_LOG_ERROR, "crossover_frequency is missing\n"); | 443 | av_log(ctx, AV_LOG_ERROR, "crossover_frequency is missing\n"); |
| 453 | uninit(ctx); | ||
| 454 | return AVERROR(EINVAL); | 444 | return AVERROR(EINVAL); |
| 455 | } | 445 | } |
| 456 | 446 | ||
| 457 | new_nb_items += sscanf(tstr2, "%lf", &s->bands[i].topfreq) == 1; | 447 | new_nb_items += sscanf(tstr2, "%lf", &s->bands[i].topfreq) == 1; |
| 458 | if (s->bands[i].topfreq < 0 || s->bands[i].topfreq >= outlink->sample_rate / 2) { | 448 | if (s->bands[i].topfreq < 0 || s->bands[i].topfreq >= outlink->sample_rate / 2) { |
| 459 | av_log(ctx, AV_LOG_ERROR, "crossover_frequency: %f, should be >=0 and lower than half of sample rate: %d.\n", s->bands[i].topfreq, outlink->sample_rate / 2); | 449 | av_log(ctx, AV_LOG_ERROR, "crossover_frequency: %f, should be >=0 and lower than half of sample rate: %d.\n", s->bands[i].topfreq, outlink->sample_rate / 2); |
| 460 | uninit(ctx); | ||
| 461 | return AVERROR(EINVAL); | 450 | return AVERROR(EINVAL); |
| 462 | } | 451 | } |
| 463 | 452 | ||
| 464 | if (s->bands[i].topfreq != 0) { | 453 | if (s->bands[i].topfreq != 0) { |
| 465 | ret = crossover_setup(outlink, &s->bands[i].filter, s->bands[i].topfreq); | 454 | ret = crossover_setup(outlink, &s->bands[i].filter, s->bands[i].topfreq); |
| 466 | if (ret < 0) { | 455 | if (ret < 0) |
| 467 | uninit(ctx); | ||
| 468 | return ret; | 456 | return ret; |
| 469 | } | ||
| 470 | } | 457 | } |
| 471 | 458 | ||
| 472 | tstr2 = av_strtok(p2, " ", &saveptr2); | 459 | tstr2 = av_strtok(p2, " ", &saveptr2); |