av_freep(&(*graph)->scale_sws_opts);
av_freep(&(*graph)->aresample_swr_opts);
+#if FF_API_LAVR_OPTS
av_freep(&(*graph)->resample_lavr_opts);
+#endif
av_freep(&(*graph)->filters);
av_freep(&(*graph)->internal);
av_freep(graph);
for (j = 0; j < outlink->in_samplerates->nb_formats; j++) {
int diff = abs(sample_rate - outlink->in_samplerates->formats[j]);
+ av_assert0(diff < INT_MAX); // This would lead to the use of uninitialized best_diff but is only possible with invalid sample rates
+
if (diff < best_diff) {
best_diff = diff;
best_idx = j;