Skip to content

Commit da8cdea

Browse files
authored
libvncclient: plug more memleaks in SASL handling
1 parent 23cbc4e commit da8cdea

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

libvncclient/sasl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ static int password_callback_adapt(sasl_conn_t *conn,
128128

129129
strcpy((char *)lsec->data, password);
130130
lsec->len = strlen(password);
131+
if (client->saslSecret)
132+
free(client->saslSecret);
131133
client->saslSecret = lsec;
132134
*secret = lsec;
133135

@@ -170,7 +172,8 @@ HandleSASLAuth(rfbClient *client)
170172
char *wantmech;
171173
const char *mechname;
172174

173-
client->saslconn = NULL;
175+
if (client->saslconn)
176+
sasl_dispose(&client->saslconn);
174177

175178
/* Sets up the SASL library as a whole */
176179
err = sasl_client_init(NULL);

0 commit comments

Comments
 (0)