GNOME Bugzilla – Bug 797131
libs: display: wayland: remove NULL check before g_free()
Last modified: 2018-09-13 09:39:58 UTC
As I know, there is no need to check display_name against NULL before calling g_free().
Created attachment 373619 [details] [review] remove NULL check before g_free function
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
Created attachment 373620 [details] [review] replace g_free with g_clear_pointer in close function.
(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.
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
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.
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.