Skip to content

Commit

Permalink
Add forgotten connection context disposal for SASL
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbes authored and Totktonada committed Oct 8, 2018
1 parent 4db64f3 commit b5d0ff5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions memcached/internal/mc_sasl.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,8 @@ int memcached_sasl_step(struct memcached_connection *con,
return -1;
}

void memcached_sasl_connection_destroy(struct memcached_connection *con) {
struct sasl_ctx *ctx = con->sasl_ctx;
sasl_dispose(&ctx->sasl_conn);
}

1 change: 1 addition & 0 deletions memcached/internal/mc_sasl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ int memcached_sasl_auth(struct memcached_connection *con, const char *mech,
int memcached_sasl_step(struct memcached_connection *con,
const char *challenge, size_t challenge_len,
const char **out, size_t *out_len);
void memcached_sasl_connection_destroy(struct memcached_connection *con);

#endif /* MC_SASL_H_INCLUDED */
1 change: 1 addition & 0 deletions memcached/internal/memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ memcached_handler(struct memcached_service *p, int fd)
/* close connection and reflect it in stats */
con.cfg->stat.curr_conns--;
iobuf_delete(con.in, con.out);
memcached_sasl_connection_destroy(&con);
free((void *)con.sasl_ctx);
const box_error_t *err = box_error_last();
if (err)
Expand Down

0 comments on commit b5d0ff5

Please sign in to comment.