replaygain: Fixed usage of gainfilter variable after free
authorAndrey Astafyev <dev@246060.ru>
Sat, 30 Nov 2019 06:18:12 +0000 (09:18 +0300)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Sun, 8 Dec 2019 09:34:57 +0000 (20:34 +1100)
src/share/replaygain_analysis/replaygain_analysis.c

index 8cf207b..37b77ab 100644 (file)
@@ -384,9 +384,12 @@ ValidGainFrequency ( long samplefreq )
 {
     struct ReplayGainFilter* gainfilter = CreateGainFilter( samplefreq );
 
-    free(gainfilter);
-
-    return gainfilter != 0;
+    if (gainfilter == 0) {
+        return 0;
+    } else {
+        free(gainfilter);
+        return 1;
+    }
 }
 
 int