[vlc-devel] [PATCH 1/2] notify: fix invalid function pointer cast

Alexandre Janniaux ajanni at videolabs.io
Sat Aug 31 10:16:35 CEST 2019


`g_list_foreach` takes a void `(*GFunc)(void*, void*)` and `g_free`
is a `void (void *)` function.
---
 modules/notify/notify.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/notify/notify.c b/modules/notify/notify.c
index 9d3e809ab3..1bab4350af 100644
--- a/modules/notify/notify.c
+++ b/modules/notify/notify.c
@@ -85,6 +85,12 @@ struct intf_sys_t
     struct vlc_player_listener_id *player_listener;
 };

+static void foreach_g_free(void *data, void *userdata)
+{
+    g_free(data);
+    VLC_UNUSED(userdata);
+}
+
 /*****************************************************************************
  * Open: initialize and create stuff
  *****************************************************************************/
@@ -137,7 +143,7 @@ static int Open( vlc_object_t *p_this )
                 break;
             }
         }
-        g_list_foreach( p_caps, (GFunc)g_free, NULL );
+        g_list_foreach( p_caps, foreach_g_free, NULL );
         g_list_free( p_caps );
     }

@@ -357,4 +363,3 @@ static int Notify( vlc_object_t *p_this, const char *psz_temp, GdkPixbuf *pix,
     p_sys->notification = notification;
     return VLC_SUCCESS;
 }
-
--
2.20.1


More information about the vlc-devel mailing list