You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@subversion.apache.org by "Daniel Shahaf (Jira)" <ji...@apache.org> on 2022/09/02 10:54:00 UTC
[jira] [Commented] (SVN-4907) svn_fs_node_id causes memory leak...
[ https://issues.apache.org/jira/browse/SVN-4907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17599398#comment-17599398 ]
Daniel Shahaf commented on SVN-4907:
------------------------------------
dev@ thread (subject "svn_fs_node_id causes memory leak", link not immdeiately available, sorry) concluded the "memory leak" was caused by an uncleared svn_error_t in user code.
> 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
> Attachments: svntest.c
>
>
> 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 *{color:#ff0000}a nonexistent path call subcommand_show_revison, the memory will leak{color}* ; but if {color:#ff0000}*a existing path, the memory is ok, no memory leak*{color} .
>
> 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))
>
> {
> {color:#FF0000}*//memory leak happens here*{color}
> 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}
> return -1;
> }
> ......
> ......
> svn_pool_destroy(pool);
> return 0;
> }
--
This message was sent by Atlassian Jira
(v8.20.10#820010)