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 739590 - A round of leak fixes
A round of leak fixes
Status: RESOLVED FIXED
Product: gnome-online-accounts
Classification: Core
Component: Kerberos
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Online Accounts maintainer(s)
GNOME Online Accounts maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-11-03 20:10 UTC by Ray Strode [halfline]
Modified: 2014-11-04 13:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
goadaemon: free presentation identity when finished with it (2.56 KB, patch)
2014-11-03 20:11 UTC, Ray Strode [halfline]
committed Details | Review
identity: plug leak in identity service (3.02 KB, patch)
2014-11-03 20:11 UTC, Ray Strode [halfline]
committed Details | Review
kerberos: plug leak in error handling (2.88 KB, patch)
2014-11-03 20:11 UTC, Ray Strode [halfline]
committed Details | Review

Description Ray Strode [halfline] 2014-11-03 20:10:59 UTC
I found a few leaks recently when working on some RHEL bugs.
Comment 1 Ray Strode [halfline] 2014-11-03 20:11:01 UTC
Created attachment 289933 [details] [review]
goadaemon: free presentation identity when finished with it

The update_account_object function reads an account's presentation
identity from the accounts configuration.  GKeyFile returns a
duped string and so the presentation identity needs to be freed.
Comment 2 Ray Strode [halfline] 2014-11-03 20:11:04 UTC
Created attachment 289934 [details] [review]
identity: plug leak in identity service

When the identity service first starts up, it gets a list
of preexisting kerberos principals and then exports them
over the bus.

The object path used for the exported objects is getting leaked.
This commit fixes that.
Comment 3 Ray Strode [halfline] 2014-11-03 20:11:08 UTC
Created attachment 289935 [details] [review]
kerberos: plug leak in error handling

It's a little tedious to convert a kerberos error into a GError,
so there's a helper function to do it: set_error_from_krb5_error_code

That helper function leaks the format string use for constructing the
GError's message.

This commit fixes that.
Comment 4 Debarshi Ray 2014-11-04 12:25:59 UTC
Review of attachment 289933 [details] [review]:

Good catch!
Comment 5 Debarshi Ray 2014-11-04 12:38:54 UTC
Review of attachment 289934 [details] [review]:

Thanks for the patch, Ray.

::: src/goaidentity/goaidentityservice.c
@@ +1602,3 @@
       const char  *principal;
       GoaObject   *object;
+      char *object_path;

Don't you want to align the '*object_path' with the previous lines? :)

@@ +1606,1 @@
+      object_path = export_identity (self, identity);

Would it be overkill to mark export_identity as G_GNUC_WARN_UNUSED_RESULT ?
Comment 6 Debarshi Ray 2014-11-04 12:44:33 UTC
Review of attachment 289935 [details] [review]:

Looks good to me.
Comment 7 Ray Strode [halfline] 2014-11-04 12:56:47 UTC
(In reply to comment #5)
> Review of attachment 289934 [details] [review]:
> 
> Thanks for the patch, Ray.
> 
> ::: src/goaidentity/goaidentityservice.c
> @@ +1602,3 @@
>        const char  *principal;
>        GoaObject   *object;
> +      char *object_path;
> 
> Don't you want to align the '*object_path' with the previous lines? :)
I do, indeed. Thanks.

> @@ +1606,1 @@
> +      object_path = export_identity (self, identity);
> 
> Would it be overkill to mark export_identity as G_GNUC_WARN_UNUSED_RESULT ?

I don't think it would be overkill, but it would be a bit out of character for the codebase, as it stands (which doesn't otherwise use that notation).  I think having a flag day adding that to the various functions that need it would be a useful (though not critical) change, but I don't think we should introduce it in this commit, imo.
Comment 8 Ray Strode [halfline] 2014-11-04 12:57:53 UTC
Attachment 289934 [details] pushed as 924d41f - identity: plug leak in identity service
Comment 9 Debarshi Ray 2014-11-04 13:05:00 UTC
(In reply to comment #7)

> I don't think it would be overkill, but it would be a bit out of character for
> the codebase, as it stands (which doesn't otherwise use that notation).  I
> think having a flag day adding that to the various functions that need it would
> be a useful (though not critical) change, but I don't think we should introduce
> it in this commit, imo.

Ok.