----- Original Message ----- > Sorry to ask, but what was the leak exactly? Ok, found some on error. You could simplify the code a bit, to unify a bit more the free() location. Perhaps have a final "cleanup:" block? > ----- Original Message ----- > > While looking at the SASL code, I noticed some memory leaks. > > --- > > gtk/spice-channel.c | 12 ++++++++---- > > 1 file changed, 8 insertions(+), 4 deletions(-) > > > > diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c > > index 08418f7..9b2697e 100644 > > --- a/gtk/spice-channel.c > > +++ b/gtk/spice-channel.c > > @@ -1387,7 +1387,9 @@ static gboolean > > spice_channel_perform_auth_sasl(SpiceChannel *channel) > > SASL_SUCCESS_DATA, > > &saslconn); > > g_free(localAddr); > > + localAddr = NULL; > > g_free(remoteAddr); > > + remoteAddr = NULL; > > > > if (err != SASL_OK) { > > g_critical("Failed to create SASL client context: %d (%s)", > > @@ -1436,8 +1438,6 @@ static gboolean > > spice_channel_perform_auth_sasl(SpiceChannel *channel) > > spice_channel_read(channel, mechlist, len); > > mechlist[len] = '\0'; > > if (c->has_error) { > > - g_free(mechlist); > > - mechlist = NULL; > > goto error; > > } > > > > @@ -1450,11 +1450,11 @@ restart: > > &clientout, > > &clientoutlen, > > &mechname); > > + g_free(mechlist); > > + mechlist = NULL; Could be also done > > if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) { > > g_critical("Failed to start SASL negotiation: %d (%s)", > > err, sasl_errdetail(saslconn)); > > - g_free(mechlist); > > - mechlist = NULL; > > goto error; > > } > > > > @@ -1640,6 +1640,10 @@ complete: > > return ret; > > > > error: > > + g_free(localAddr); > > + g_free(remoteAddr); > > + g_free(mechlist); > > + g_free(serverin); > > g_clear_object(&addr); > > if (saslconn) > > sasl_dispose(&saslconn); > > -- > > 1.8.3.1 > > > > _______________________________________________ > > Spice-devel mailing list > > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > > http://lists.freedesktop.org/mailman/listinfo/spice-devel > > > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel