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 760670 - meta-launch: don't call g_object_unref on NULL
meta-launch: don't call g_object_unref on NULL
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2016-01-15 12:13 UTC by Marek Chalupa
Modified: 2017-09-01 09:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't unref NULL pointer (2.09 KB, patch)
2016-01-15 12:13 UTC, Marek Chalupa
committed Details | Review
meta-launcher: Avoid leaking a GUdevDevice (1.09 KB, patch)
2016-01-21 16:02 UTC, Rui Matos
none Details | Review
meta-launcher: Use g_auto* macros (4.60 KB, patch)
2016-01-21 17:58 UTC, Rui Matos
committed Details | Review
build: Require libgudev >= 232 (1.55 KB, patch)
2017-09-01 00:08 UTC, Bastien Nocera
committed Details | Review

Description Marek Chalupa 2016-01-15 12:13:38 UTC
Created attachment 319097 [details] [review]
Don't unref NULL pointer

g_object_unref was called unconditionally on pointer that may have been NULL in get_primary_gpu_path resulting in a bunch of CRITICAL messages
Comment 1 Rui Matos 2016-01-15 15:08:13 UTC
Review of attachment 319097 [details] [review]:

lgtm
Comment 2 Ray Strode [halfline] 2016-01-21 14:54:47 UTC
Review of attachment 319097 [details] [review]:

::: src/backends/native/meta-launcher.c
@@ +342,3 @@
               /* found the boot_vga device */
               path = g_strdup (g_udev_device_get_device_file (dev));
+              break;

doesn't this break the pci_device is going to get leaked ?
Comment 3 Rui Matos 2016-01-21 16:02:42 UTC
Created attachment 319510 [details] [review]
meta-launcher: Avoid leaking a GUdevDevice

--

oops, thanks for catching that
Comment 4 Jasper St. Pierre (not reading bugmail) 2016-01-21 16:04:12 UTC
Review of attachment 319510 [details] [review]:

Could you use g_autoptr?
Comment 5 Rui Matos 2016-01-21 17:58:42 UTC
Created attachment 319516 [details] [review]
meta-launcher: Use g_auto* macros

This fixes a couple of minor memory leaks.
--

I keep forgetting this is a thing now.

I had to add the G_DEFINE_AUTOPTRs here though since both GUdev and
gdbus-codegen don't have them yet. I guess we can remove them when
those upstreams add them and break the build?
Comment 6 Rui Matos 2016-01-21 18:50:27 UTC
See bug 755797 for a gdbus-codegen patch
Comment 7 Jasper St. Pierre (not reading bugmail) 2016-01-21 19:32:18 UTC
Review of attachment 319516 [details] [review]:

OK.
Comment 8 Rui Matos 2016-01-25 13:04:41 UTC
Attachment 319516 [details] pushed as 3cdcd3e - meta-launcher: Use g_auto* macros
Comment 9 Emmanuele Bassi (:ebassi) 2017-08-31 22:14:24 UTC
(In reply to Rui Matos from comment #5)

> I had to add the G_DEFINE_AUTOPTRs here though since both GUdev and
> gdbus-codegen don't have them yet. I guess we can remove them when
> those upstreams add them and break the build?

The time is now:

https://git.gnome.org/browse/libgudev/commit/?id=272533131c6ed38479a88805c023d8375fb38adc

Which means Mutter's build is now broken in Continuous.
Comment 10 Bastien Nocera 2017-08-31 22:17:30 UTC
(In reply to Rui Matos from comment #5)
<snip>
> I had to add the G_DEFINE_AUTOPTRs here though since both GUdev and
> gdbus-codegen don't have them yet. I guess we can remove them when
> those upstreams add them and break the build?

libgudev was already a GNOME project at the time this was written:
https://git.gnome.org/browse/libgudev

So the upstream would have been us anyway.

I'll release version 232 today, which you can depend on for that functionality.
Comment 11 Bastien Nocera 2017-08-31 23:59:50 UTC
(In reply to Bastien Nocera from comment #10)
> I'll release version 232 today, which you can depend on for that
> functionality.

Released:
https://download.gnome.org/sources/libgudev/232/
Comment 12 Bastien Nocera 2017-09-01 00:08:30 UTC
Created attachment 358904 [details] [review]
build: Require libgudev >= 232

And remove the g_autoptr implementations in mutter itself.
Comment 13 Jonas Ådahl 2017-09-01 02:08:45 UTC
Review of attachment 358904 [details] [review]:

lgtm
Comment 14 Bastien Nocera 2017-09-01 09:20:22 UTC
Attachment 358904 [details] pushed as 361bf84 - build: Require libgudev >= 232