[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] svnadmin lsdblogs, fs.c, Windows

From: Martin Hauner <hauner_at_web.de>
Date: 2003-08-21 17:44:21 CEST

Hi all,

here is a small fix for a memory problem in svn_fs_berkeley_logfiles.
It gets called when you run svnadmin lsdblogs.

attached is an 'in place fix'...

-- 
Martin

* subversion/libsvn_fs/fs.c
  (svn_fs_berkeley_logfiles): fixed memory alloc/free of filelist on
  windows.

Index: subversion/libsvn_fs/fs.c
===================================================================
--- subversion/libsvn_fs/fs.c (revision 6811)
+++ subversion/libsvn_fs/fs.c (working copy)
@@ -657,6 +657,10 @@
   *logfiles = apr_array_make (pool, 4, sizeof (const char *));

   SVN_BDB_ERR (db_env_create (&env, 0));
+ /* Windows: tell the bdb dll to use "our" heap to allocate filelist.
+ On Windows dlls have their own heap and we have to make sure
+ filelist is allocated from the same heap we free it from. */
+ SVN_BDB_ERR (env->set_alloc (env,malloc,realloc,free));

   SVN_ERR (svn_utf_cstring_from_utf8 (&path_native, path, pool));
   SVN_BDB_ERR (env->open (env, path_native, (DB_CREATE
@@ -676,9 +680,7 @@
       APR_ARRAY_PUSH (*logfiles, const char *) = apr_pstrdup (pool, *filename);
     }

- /* allocate_env sets malloc and free as the memory management functions,
- therefore we use free to release memory allocated by DB_ENV */
- free (filelist);
+ env->db_free (filelist);

   SVN_BDB_ERR (env->close (env, 0));

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 21 17:47:53 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.