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