Yes, when I was free svn_error_t's pool , no memory leak.

Why svn_error_t create a new memory pool , not use pool ?

  svn_error_t *err = svn_fs_node_id(id, *root, *path_relative, pool);
  if(err != SVN_NO_ERROR || !id )
  {
    if(err != SVN_NO_ERROR)
  svn_pool_destroy(err->pool);


Best Regards!
Haiyuan Qian
R & D Management Group
Hangzhou Hikvision Digital Technology Co.,Ltd
No.555 Qianmo Road, Binjiang District, Hangzhou 310052, China
M (86)18969199712

本邮件及其附件含有海康威视公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
This e-mail and its attachments contain confidential information from 
HIKVISION, which is intended only for  the person or entity whose address is 
listed above. Any use of the information contained herein in any way 
(including, but not limited to, total or partial disclosure, reproduction, or 
dissemination) by persons other  than the intended recipient(s) is prohibited. 
If you receive this e-mail in error, please notify the sender by phone or email 
immediately and delete it!

-----邮件原件-----
发件人: Yasuhito FUTATSUKI <futat...@yf.bsdclub.org>
发送时间: 2022年8月31日 0:52
收件人: 钱海远(Nathan) <qianhaiy...@hikvision.com>; Subversion Developers 
<dev@subversion.apache.org>
主题: Re: svn_fs_node_id causes memory leak...

Hello,

On 2022/08/30 11:33, 钱海远(Nathan) wrote:
> Dear Sir,
>
> I found that svn_fs_node_id causes memory leak. I had report the issue
> in jira:
> https://issues.apache.org/jira/browse/SVN-4907?jql=project%20%3D%20SVN
>
> Daniel Shahaf need some more info :
>
> Q: Can you attach a code sample that we can compile and run ourselves and 
> reproduces the problem?
> A: The demo code :
> https://issues.apache.org/jira/secure/attachment/13048592/svntest.c

[[[
...
  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;
...
]]]

If a return value of svn_fs_node_id() is not SVN_NO_ERROR, it is an svn_error_t 
object which was allocated from global pool, and it should be cleared by 
svn_error_clear(). Otherwise it causes memory leak.

I think the problem is not svn_fs_node_id() (in this case it is actually 
svn_fs_fs__id_node_id()) itself but how use it.

Cheers,
--
Yasuhito FUTATSUKI <futat...@yf.bsclub.org>

________________________________

CONFIDENTIALITY NOTICE: This electronic message is intended to be viewed only 
by the individual or entity to whom it is addressed. It may contain information 
that is privileged, confidential and exempt from disclosure under applicable 
law. Any dissemination, distribution or copying of this communication is 
strictly prohibited without our prior permission. If the reader of this message 
is not the intended recipient, or the employee or agent responsible for 
delivering the message to the intended recipient, or if you have received this 
communication in error, please notify us immediately by return e-mail and 
delete the original message and any copies of it from your computer system. For 
further information about Hikvision company. please see our website at 
www.hikvision.com<http://www.hikvision.com>

Reply via email to