On 2014-10-22 10:59, Svante Signell wrote:
On Wed, 2014-10-22 at 10:29 +0200, Pino Toscano wrote:On 2014-10-22 10:21, Svante Signell wrote: > On Wed, 2014-10-22 at 01:21 +0200, Samuel Thibault wrote: >> Svante Signell, le Tue 21 Oct 2014 12:34:22 +0200, a écrit :> + free (tmp); > + return ret; > } glib has g_strdup_printf, so just make use of it instead of doing custom malloc code;Updated patch attached. For the first part of the patch, I don't findusing g_strdup_printf() is an advantage over g_malloc(), since later ong_realloc() is needed.
The other option is to just use a different buffer for each path, which could actually simplify the code (you are also not checking whether a new length is smaller than the previous one, to avoid realloc).
also, use g_free instead of free.This was a typo, see the rest of the patch.
There's still one free left in your patch. Also, the following change seems unneeded: - if (archive_entry_pathname (entry) == NULL) + pathname = archive_entry_pathname (entry); + if (pathname == NULL) Note that «strlen(tmp)» should be «strlen (tmp)», per coding style there. -- Pino Toscano