Re: More on tilde expansion


The last patch is obviously bad as Pavel Shirshov pointed out to me.
Problem is with the *orig_mask = 0 that I removed. This assignment
terminates the string in case of else in the following block, but it
null terminates dest_dir in the case the if is true:

    if (ctx->dest_mask == NULL)
	ctx->dest_mask = dest_dir;

I thought the following g_free would thus not release the entire
allocated memory for dest_dir and thus cause a memory leak:

    if (!*dest_dir) {
	g_free (dest_dir);

Is this assumption wrong? Will g_free free all the allocated memory even
though the first byte is a 0 byte?


mount -t life -o ro /dev/dna /genetic/research

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