[Bug 785429] wavparse: Fixed memory leak in gstwavparse.c

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Wed Aug 9 11:32:20 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=785429

Sebastian Dröge (slomo) <slomo at coaxion.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #356717|none                        |needs-work
             status|                            |

--- Comment #7 from Sebastian Dröge (slomo) <slomo at coaxion.net> ---
Review of attachment 356717:
 --> (https://bugzilla.gnome.org/review?bug=785429&attachment=356717)

Please run your code through "gst-indent"

::: gst/wavparse/gstwavparse.c
@@ +95,3 @@

+static void gst_wavparse_labl_chunk_remove_data(GList* object);
+static void gst_wavparse_note_chunk_remove_data(GList* object);

How about gst_wavparse_notes_free() instead? Shorter and more consistent

@@ +806,3 @@
+{
+  if(!labl_list)
+    return;

You already check for NULL in the callers

@@ +807,3 @@
+  if(!labl_list)
+    return;
+  for(GList* l = labl_list; l; l = l->next)

This is C99, please declare the list at the top of the block

@@ +811,3 @@
+     GstWavParseLabl *labl = (GstWavParseLabl*)l->data;
+     if(labl->text)
+       g_free(labl->text);

g_free(NULL) is valid, no need to check for NULL first

@@ +813,3 @@
+       g_free(labl->text);
+  }
+  g_list_free_full (labl_list, g_free);

More useful would probably be "g_list_free_full (labl_list, labl_free)" instaed
of having the loop above, and just freeing everything in the newly defined
labl_free function.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list