[ 
https://issues.apache.org/jira/browse/SVN-4907?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nathan.qian updated SVN-4907:
-----------------------------
    Environment:     (was: We used svnlook to transform a dynamic library for 
some of our interface operations. We found that memory leaks would occur when 
svn_fs_node_id (with apr_pool_t  and svn_pool_destroy(pool)) was called 
frequently;


The code looks shown below, we call svn_fs_node_id with apr_pool_t , and after 
the call , we use svn_pool_destroy(pool) clear memory. But there is a bug : if 
we  use a nonexistent path call subcommand_show_revison, the  memory will leak 
; but if a existing path, the memory is ok, no memory leak .

 

int init_svncmcenter(apr_pool_t *pool,char *out_str,const char 
*repos_path,const char *path,const char **path_relative,const char *rev,struct 
svnlook_opt_state *opt_state,svn_fs_root_t **root,const svn_fs_id_t 
**id,svnlook_ctxt_t * *c,int with_lastexist )
{
......
......
if ((svn_fs_node_id(id, *root, *path_relative, pool)) != SVN_NO_ERROR || !(*id))
{
printf("path (%s) error. Warning: svn_fs_node_id may cause memory leaks.\n", 
path);
sprintf(out_str,"212 path error");
return 212;
}
        return 200;
}

int subcommand_show_revison(const char *repos_path,const char *path,const char 
*rev,char *out_str,int b_filesize,int with_changed_date,int with_author)
{
  apr_pool_t *pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
......
......
  if (init_svncmcenter(pool,out_str, repos_path, 
path,&path_relative,rev,&opt_state,&root,&id,&c,1) != 200)
  {
{color:#FF0000}  *svn_pool_destroy(pool);*{color}

{color:#FF0000}*//memory leak happens here*{color}
  return -1;
  }
......
......
  svn_pool_destroy(pool);
  return 0;
})

> svn_fs_node_id causes memory leak...
> ------------------------------------
>
>                 Key: SVN-4907
>                 URL: https://issues.apache.org/jira/browse/SVN-4907
>             Project: Subversion
>          Issue Type: Bug
>          Components: svnlook
>    Affects Versions: 1.10.x
>            Reporter: Nathan.qian
>            Priority: Critical
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to