chacha_poly1305_set_key(ctx, mesh->config_key);
if(len > 12 && chacha_poly1305_decrypt_iv96(ctx, buf, buf + 12, len - 12, decrypted, &decrypted_len)) {
+ chacha_poly1305_exit(ctx);
free(buf);
config->buf = decrypted;
config->len = decrypted_len;
} else {
logger(mesh, MESHLINK_ERROR, "Cannot decrypt config file\n");
meshlink_errno = MESHLINK_ESTORAGE;
+ chacha_poly1305_exit(ctx);
free(decrypted);
free(buf);
return false;
DIR *dir;
struct dirent *ent;
char dname[PATH_MAX];
- make_host_path(mesh, NULL, dname, sizeof(dname));
+ make_host_path(mesh, "", dname, sizeof(dname));
dir = opendir(dname);