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

Leaking temporary resources

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sat, 18 Sep 2010 18:47:19 +0100

http://colabti.org/irclogger/irclogger_log/svn-dev?date=2010-09-07#l40
describes a scenario where a file handle would be leaked due to a pool
not being freed; specifically,

        parent(pool) calls child(pool);
        child(pool) allocates handle from POOL;
        child(pool) triggers an SVN_ERR();
        handle remains allocated.

Are there any other cases where this would be a problem?

Should we adopt a strategy of

        #define SVN_ERR_CLEAR(expr, scratch_pool)
                do {
                        svn_error_clear(scratch_pool);
                        SVN_ERR(expr);
                } while(0)

at least in some functions taking a scratch_pool argument?

(We could have this only for maintainer-mode builds, and
#define SVN_ERR_CLEAR(expr, pool) SVN_ERR(expr)
for normal builds.)
Received on 2010-09-18 19:48:33 CEST

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