More on tilde expansion

Leonard den Ottolander leonard at den.ottolander.nl
Mon Sep 20 22:15:21 UTC 2004


Hi,

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;
    else
	ctx->dest_mask++;

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?

Leonard.

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





More information about the mc-devel mailing list