[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Eliminate use of large buffer on stack in virFileMakePath.

On Mon, Jan 25, 2010 at 03:36:30PM +0100, Daniel Veillard wrote:
> On Fri, Jan 22, 2010 at 02:04:19PM -0500, Laine Stump wrote:
> > virFileMakePath is a recursive function that was creates a buffer
> > PATH_MAX bytes long for each recursion (one recursion for each element
> > in the path). This changes it to have no buffers on the stack, and to
> > allocate just one buffer total, no matter how many elements are in the
> > path. Because the modified algorithm requires a char* to be passed in
> > rather than const char *, it is now 2 functions - a toplevel API
> > function that remains identical in function, and a 2nd helper function
> > called for the recursions, which 1) doesn't allocate anything, and 2)
> > takes a char* arg, so it can modify the contents.
> > 
> > src/util/util.c: rewrite virFileMakePath
>   ACK, good catch !

  Okay, pushed, thanks !


Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]