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 <[email protected]>