Fix svn module memory leaks

This commit is contained in:
David Maciejak 2019-03-07 08:12:04 +08:00
parent 59ef84522b
commit 91825f0fef
2 changed files with 4 additions and 3 deletions

View file

@ -3,6 +3,7 @@ Changelog for hydra
Release 8.9-dev Release 8.9-dev
* your patch? :) * your patch? :)
* Fix svn module memory leaks
Release 8.9.1 Release 8.9.1

View file

@ -78,17 +78,19 @@ int32_t start_svn(int32_t s, char *ip, int32_t port, unsigned char options, char
err = svn_config_ensure(NULL, pool); err = svn_config_ensure(NULL, pool);
if (err) { if (err) {
svn_pool_destroy(pool);
svn_handle_error2(err, stderr, FALSE, "hydra: "); svn_handle_error2(err, stderr, FALSE, "hydra: ");
return 4; return 4;
} }
//if ((err = svn_client_create_context(&ctx, pool))) {
if ((err = svn_client_create_context2(&ctx, NULL, pool))) { if ((err = svn_client_create_context2(&ctx, NULL, pool))) {
svn_pool_destroy(pool);
svn_handle_error2(err, stderr, FALSE, "hydra: "); svn_handle_error2(err, stderr, FALSE, "hydra: ");
return 4; return 4;
} }
if ((err = svn_config_get_config(&(ctx->config), NULL, pool))) { if ((err = svn_config_get_config(&(ctx->config), NULL, pool))) {
svn_pool_destroy(pool);
svn_handle_error2(err, stderr, FALSE, "hydra: "); svn_handle_error2(err, stderr, FALSE, "hydra: ");
return 4; return 4;
} }
@ -106,10 +108,8 @@ int32_t start_svn(int32_t s, char *ip, int32_t port, unsigned char options, char
snprintf(URL, sizeof(URL), "svn://%s:%d/%s", hydra_address2string_beautiful(ip), port, URLBRANCH); snprintf(URL, sizeof(URL), "svn://%s:%d/%s", hydra_address2string_beautiful(ip), port, URLBRANCH);
dirents = SVN_DIRENT_KIND; dirents = SVN_DIRENT_KIND;
canonical = svn_uri_canonicalize(URL, pool); canonical = svn_uri_canonicalize(URL, pool);
//err = svn_client_list2(canonical, &revision, &revision, svn_depth_unknown, dirents, FALSE, print_dirdummy, NULL, ctx, pool);
err = svn_client_list3(canonical, &revision, &revision, svn_depth_unknown, dirents, FALSE, FALSE, (svn_client_list_func2_t) print_dirdummy, NULL, ctx, pool); err = svn_client_list3(canonical, &revision, &revision, svn_depth_unknown, dirents, FALSE, FALSE, (svn_client_list_func2_t) print_dirdummy, NULL, ctx, pool);
svn_pool_clear(pool);
svn_pool_destroy(pool); svn_pool_destroy(pool);
if (err) { if (err) {