---
 libavresample/audio_convert.c |  2 +-
 libavresample/audio_data.c    |  6 +++---
 libavresample/audio_mix.c     | 12 ++++++------
 libavresample/dither.c        |  4 ++--
 libavresample/resample.c      |  8 ++++----
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/libavresample/audio_convert.c b/libavresample/audio_convert.c
index ef23912..8c59c55 100644
--- a/libavresample/audio_convert.c
+++ b/libavresample/audio_convert.c
@@ -282,7 +282,7 @@ AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext 
*avr,
         ac->dc = ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate,
                                  apply_map);
         if (!ac->dc) {
-            av_free(ac);
+            av_freep(&ac);
             return NULL;
         }
         return ac;
diff --git a/libavresample/audio_data.c b/libavresample/audio_data.c
index 7a6fe74..78db598 100644
--- a/libavresample/audio_data.c
+++ b/libavresample/audio_data.c
@@ -130,7 +130,7 @@ AudioData *ff_audio_data_alloc(int channels, int nb_samples,
 
     a->sample_size = av_get_bytes_per_sample(sample_fmt);
     if (!a->sample_size) {
-        av_free(a);
+        av_freep(&a);
         return NULL;
     }
     a->is_planar = ff_sample_fmt_is_planar(sample_fmt, channels);
@@ -148,7 +148,7 @@ AudioData *ff_audio_data_alloc(int channels, int nb_samples,
     if (nb_samples > 0) {
         ret = ff_audio_data_realloc(a, nb_samples);
         if (ret < 0) {
-            av_free(a);
+            av_freep(&a);
             return NULL;
         }
         return a;
@@ -217,7 +217,7 @@ void ff_audio_data_free(AudioData **a)
 {
     if (!*a)
         return;
-    av_free((*a)->buffer);
+    av_freep(&(*a)->buffer);
     av_freep(a);
 }
 
diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c
index 8619c1a..e523b63 100644
--- a/libavresample/audio_mix.c
+++ b/libavresample/audio_mix.c
@@ -385,24 +385,24 @@ AudioMix *ff_audio_mix_alloc(AVAudioResampleContext *avr)
                                       avr->in_channels,
                                       avr->matrix_encoding);
         if (ret < 0) {
-            av_free(matrix_dbl);
+            av_freep(&matrix_dbl);
             goto error;
         }
 
         ret = ff_audio_mix_set_matrix(am, matrix_dbl, avr->in_channels);
         if (ret < 0) {
             av_log(avr, AV_LOG_ERROR, "error setting mix matrix\n");
-            av_free(matrix_dbl);
+            av_freep(&matrix_dbl);
             goto error;
         }
 
-        av_free(matrix_dbl);
+        av_freep(&matrix_dbl);
     }
 
     return am;
 
 error:
-    av_free(am);
+    av_freep(&am);
     return NULL;
 }
 
@@ -415,7 +415,7 @@ void ff_audio_mix_free(AudioMix **am_p)
     am = *am_p;
 
     if (am->matrix) {
-        av_free(am->matrix[0]);
+        av_freep(&am->matrix[0]);
         am->matrix = NULL;
     }
     memset(am->matrix_q8,  0, sizeof(am->matrix_q8 ));
@@ -663,7 +663,7 @@ int ff_audio_mix_set_matrix(AudioMix *am, const double 
*matrix, int stride)
     }
 
     if (am->matrix) {
-        av_free(am->matrix[0]);
+        av_freep(&am->matrix[0]);
         am->matrix = NULL;
     }
 
diff --git a/libavresample/dither.c b/libavresample/dither.c
index 17de829..7d33b9e 100644
--- a/libavresample/dither.c
+++ b/libavresample/dither.c
@@ -321,8 +321,8 @@ void ff_dither_free(DitherContext **cp)
     ff_audio_convert_free(&c->ac_in);
     ff_audio_convert_free(&c->ac_out);
     for (ch = 0; ch < c->channels; ch++)
-        av_free(c->state[ch].noise_buf);
-    av_free(c->state);
+        av_freep(&c->state[ch].noise_buf);
+    av_freep(&c->state);
     av_freep(cp);
 }
 
diff --git a/libavresample/resample.c b/libavresample/resample.c
index 4553b2c..e078868 100644
--- a/libavresample/resample.c
+++ b/libavresample/resample.c
@@ -113,7 +113,7 @@ static int build_filter(ResampleContext *c, double factor)
         c->set_filter(c->filter_bank, tab, ph, tap_count);
     }
 
-    av_free(tab);
+    av_freep(&tab);
     return 0;
 }
 
@@ -214,8 +214,8 @@ ResampleContext 
*ff_audio_resample_init(AVAudioResampleContext *avr)
 
 error:
     ff_audio_data_free(&c->buffer);
-    av_free(c->filter_bank);
-    av_free(c);
+    av_freep(&c->filter_bank);
+    av_freep(&c);
     return NULL;
 }
 
@@ -224,7 +224,7 @@ void ff_audio_resample_free(ResampleContext **c)
     if (!*c)
         return;
     ff_audio_data_free(&(*c)->buffer);
-    av_free((*c)->filter_bank);
+    av_freep(&(*c)->filter_bank);
     av_freep(c);
 }
 
-- 
1.9.3 (Apple Git-50)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to