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

Re: svn commit: rev 4559 - trunk/subversion/libsvn_subr

From: <cmpilato_at_collab.net>
Date: 2003-01-24 16:08:16 CET

philip@tigris.org writes:

 Author: philip
 Date: 2003-01-24 06:40:32 -0600 (Fri, 24 Jan 2003)
 New Revision: 4559
 Fix another memory problem tracked down with valgrind.
 * subversion/libsvn_subr/path.c (svn_path_uri_encode): Allocate space for
   sprintf null.

I was wondering the other day if we shouldn't just do a single
svn_stringbuf_ensure here. Either always do one at the beginning:

   svn_stringbuf_ensure(retstr, strlen (path) * 3) + 1);

   (This is worst case -- each char is replaced by three (%XX), and
    then room for the NULL at the end)

Or, do it the first time we find a char that needs replacing (someone
check my math):

   svn_stringbuf_ensure(retstr, copied + strlen (path + copied) * 3) + 1);

Anyway, just an idea.

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 14 02:13:38 2006

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.