[Spice-commits] src/spice-gstaudio.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jan 22 16:55:12 UTC 2019
src/spice-gstaudio.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
New commits:
commit 21e753ffde54e5f75ac3ad9c5cb26572d410532b
Author: Victor Toso <me at victortoso.com>
Date: Tue Jan 22 16:33:59 2019 +0100
gstaudio: fix ci due potential null pointer dereference
Can't happen as GstElement *e is not NULL but not checking can yield
warning from compilers.
> spice-gstaudio.c: In function ‘playback_volume_changed’:
> /usr/include/glib-2.0/gobject/gtype.h:2280:70: error: potential null pointer dereference [-Werror=null-dereference]
> #define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class))
> ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
> /usr/include/glib-2.0/gobject/gtype.h:525:66: note: in expansion of macro ‘_G_TYPE_IGC’
> #define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type) (_G_TYPE_IGC ((instance), (g_type), c_type))
> ^~~~~~~~~~~
> /usr/include/glib-2.0/gobject/gobject.h:86:38: note: in expansion of macro ‘G_TYPE_INSTANCE_GET_CLASS’
> #define G_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass))
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> spice-gstaudio.c:373:45: note: in expansion of macro ‘G_OBJECT_GET_CLASS’
> } else if (g_object_class_find_property(G_OBJECT_GET_CLASS (e), "volume") != NULL) {
> ^~~~~~~~~~~~~~~~~~
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
index 51ff028..5f4a2fe 100644
--- a/src/spice-gstaudio.c
+++ b/src/spice-gstaudio.c
@@ -368,6 +368,9 @@ static void playback_volume_changed(GObject *object, GParamSpec *pspec, gpointer
if (!e)
e = g_object_ref(p->playback.sink);
+ /* Double check to make compiler happy */
+ g_return_if_fail(e != NULL);
+
if (GST_IS_STREAM_VOLUME(e)) {
gst_stream_volume_set_volume(GST_STREAM_VOLUME(e), GST_STREAM_VOLUME_FORMAT_CUBIC, vol);
} else if (g_object_class_find_property(G_OBJECT_GET_CLASS (e), "volume") != NULL) {
@@ -397,6 +400,9 @@ static void playback_mute_changed(GObject *object, GParamSpec *pspec, gpointer d
if (!e)
e = g_object_ref(p->playback.sink);
+ /* Double check to make compiler happy */
+ g_return_if_fail(e != NULL);
+
if (GST_IS_STREAM_VOLUME(e)) {
gst_stream_volume_set_mute(GST_STREAM_VOLUME(e), mute);
} else if (g_object_class_find_property(G_OBJECT_GET_CLASS (e), "mute") != NULL) {
@@ -435,6 +441,9 @@ static void record_volume_changed(GObject *object, GParamSpec *pspec, gpointer d
if (!e)
e = g_object_ref(p->record.src);
+ /* Double check to make compiler happy */
+ g_return_if_fail(e != NULL);
+
if (GST_IS_STREAM_VOLUME(e)) {
gst_stream_volume_set_volume(GST_STREAM_VOLUME(e), GST_STREAM_VOLUME_FORMAT_CUBIC, vol);
} else if (g_object_class_find_property(G_OBJECT_GET_CLASS (e), "volume") != NULL) {
@@ -464,6 +473,9 @@ static void record_mute_changed(GObject *object, GParamSpec *pspec, gpointer dat
if (!e)
e = g_object_ref(p->record.src);
+ /* Double check to make compiler happy */
+ g_return_if_fail(e != NULL);
+
if (GST_IS_STREAM_VOLUME (e)) {
gst_stream_volume_set_mute(GST_STREAM_VOLUME(e), mute);
} else if (g_object_class_find_property(G_OBJECT_GET_CLASS (e), "mute") != NULL) {
More information about the Spice-commits
mailing list