After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 797131 - libs: display: wayland: remove NULL check before g_free()
libs: display: wayland: remove NULL check before g_free()
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
git master
Other Linux
: Normal minor
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-09-12 10:21 UTC by Jimmy Ohn
Modified: 2018-09-13 09:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
remove NULL check before g_free function (1020 bytes, patch)
2018-09-12 10:39 UTC, Jimmy Ohn
none Details | Review
replace g_free with g_clear_pointer in close function. (2.99 KB, patch)
2018-09-12 13:36 UTC, Jimmy Ohn
none Details | Review
replace g_free with g_clear_pointer in close function. (5.23 KB, patch)
2018-09-13 07:34 UTC, Jimmy Ohn
committed Details | Review

Description Jimmy Ohn 2018-09-12 10:21:02 UTC
As I know, there is no need to check display_name against NULL before calling g_free().
Comment 1 Jimmy Ohn 2018-09-12 10:39:14 UTC
Created attachment 373619 [details] [review]
remove NULL check before g_free function
Comment 2 Víctor Manuel Jáquez Leal 2018-09-12 11:52:44 UTC
Comment on attachment 373619 [details] [review]
remove NULL check before g_free function

please change it to g_pointer_clean(), and not only priv->display_name but most of the wayland display members in close() method.

https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-clear-pointer
Comment 3 Jimmy Ohn 2018-09-12 13:36:21 UTC
Created attachment 373620 [details] [review]
replace g_free with g_clear_pointer in close function.
Comment 4 Jimmy Ohn 2018-09-12 13:43:25 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #2)
> Comment on attachment 373619 [details] [review] [review]
> remove NULL check before g_free function
> 
> please change it to g_pointer_clean(), and not only priv->display_name but
> most of the wayland display members in close() method.
> 
> https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-clear-
> pointer

I have updated new patch-set. I appreciate your help.
Comment 5 Víctor Manuel Jáquez Leal 2018-09-12 14:08:25 UTC
Review of attachment 373620 [details] [review]:

cool! More than I expected!

I guess that would be more than Ok, but if you are willing to continue working on this, you can also call g_clear_pointer with other deallocators.

For example, you can do the same with wayland, such as here

https://github.com/Igalia/WPEBackend-fdo/blob/da746af2dff6b972c5c4903a132edcafdb768926/src/renderer-backend-egl.cpp#L139
Comment 6 Jimmy Ohn 2018-09-13 07:34:22 UTC
Created attachment 373622 [details] [review]
replace g_free with g_clear_pointer in close function.

Thanks for your kindly support.
I've updated it to g_pointer_clean function with other deallocators. If I have  missing something, please let me know.
Comment 7 Víctor Manuel Jáquez Leal 2018-09-13 09:39:12 UTC
pushed attachment 373622 [details] [review] as commit 7b077cdc - libs: use g_clear_pointer() when possible

I have changed the commit log since it didn't express what the patch actually does.