[Spice-devel] [PATCH spice-gtk v3 4/7] spice-uri: Reset SpiceUri before parsing

Christophe Fergeau cfergeau at redhat.com
Fri May 20 12:46:05 UTC 2016


On Fri, May 20, 2016 at 11:07:58AM +0200, Pavel Grunt wrote:
> > > diff --git a/src/spice-uri.c b/src/spice-uri.c
> > > index 3bdb502..04ea3cb 100644
> > > --- a/src/spice-uri.c
> > > +++ b/src/spice-uri.c
> > > @@ -105,6 +105,13 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar
> > > *_uri, GError **error)
> > >      size_t len;
> > > 
> > >      g_return_val_if_fail(self != NULL, FALSE);
> > > +
> > > +    self->scheme = NULL;
> > > +    self->hostname = NULL;
> > > +    self->port = 0;
> > > +    self->user = NULL;
> > > +    self->password = NULL;
> > > +
> > 
> > g_clear_pointer to avoid leaks?
> 
> sure, thanks a lot, stupid me /o\

You could introduce a spice_uri_reset() which does that and is reused in
_finalize().

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160520/ef4d3347/attachment.sig>


More information about the Spice-devel mailing list