diff --git a/main.c b/main.c index 8a3090e..ae3daf8 100644 --- a/main.c +++ b/main.c @@ -911,6 +911,8 @@ main(int argc, char *argv[]) out_parent: opts_free(opts); ssl_fini(); + if (natengine) + free(natengine); return rv; } diff --git a/opts.c b/opts.c index be03820..15af952 100644 --- a/opts.c +++ b/opts.c @@ -162,6 +162,9 @@ opts_free(opts_t *opts) if (opts->connectlog) { free(opts->connectlog); } + if (opts->conffile) { + free(opts->conffile); + } if (opts->contentlog) { free(opts->contentlog); } @@ -1644,9 +1647,8 @@ opts_set_option(opts_t *opts, const char *argv0, const char *optarg, retval = set_option(opts, argv0, name, value, natengine, 0); } - if (line) { + if (line) free(line); - } return retval; } @@ -1694,13 +1696,14 @@ load_conffile(opts_t *opts, const char *argv0, char **natengine) if (retval == -1) { goto leave; } + free(line); + line = NULL; } leave: fclose(f); - if (line) { + if (line) free(line); - } return retval; } diff --git a/pxyconn.c b/pxyconn.c index 70dbdc1..e69de20 100644 --- a/pxyconn.c +++ b/pxyconn.c @@ -1301,7 +1301,10 @@ bufferevent_free_and_close_fd(struct bufferevent *bev, pxy_conn_ctx_t *ctx) } SSL_free(ssl); } - evutil_closesocket(fd); + /* bufferevent_getfd() returns -1 if no file descriptor is associated + * with the bufferevent */ + if (fd >= 0) + evutil_closesocket(fd); } /*