The list will persist will the SASL connection is not disposed (or another sasl_listmech called). Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/red-stream.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/red-stream.c b/server/red-stream.c index b5eb7cd3..321612ba 100644 --- a/server/red-stream.c +++ b/server/red-stream.c @@ -68,7 +68,7 @@ typedef struct RedSASL { SpiceBuffer inbuffer; - char *mechlist; + const char *mechlist; char *mechname; /* temporary data during authentication */ @@ -354,9 +354,7 @@ void red_stream_free(RedStream *s) s->priv->sasl.len = 0; s->priv->sasl.encodedLength = s->priv->sasl.encodedOffset = 0; s->priv->sasl.encoded = NULL; - g_free(s->priv->sasl.mechlist); g_free(s->priv->sasl.mechname); - s->priv->sasl.mechlist = NULL; g_free(s->priv->sasl.data); sasl_dispose(&s->priv->sasl.conn); s->priv->sasl.conn = NULL; @@ -1110,7 +1108,7 @@ bool red_sasl_start_auth(RedStream *stream, AsyncReadDone read_cb, void *opaque) spice_debug("Available mechanisms for client: '%s'", mechlist); - sasl->mechlist = g_strdup(mechlist); + sasl->mechlist = mechlist; mechlistlen = strlen(mechlist); if (!red_stream_write_all(stream, &mechlistlen, sizeof(uint32_t)) @@ -1126,6 +1124,7 @@ bool red_sasl_start_auth(RedStream *stream, AsyncReadDone read_cb, void *opaque) return true; error_dispose: + sasl->mechlist = NULL; sasl_dispose(&sasl->conn); sasl->conn = NULL; error: -- 2.14.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel