There's an error in the function dcc_free_argv.   The call to free(a) should really be free(*a), since the former is calling free on the array itself, instead of the memory allocated.
The short function is below:

void dcc_free_argv(char **argv)
{
    char **a;

    for (a = argv; *a != NULL; a++)
        free(a);  // should be free(*a);
    free(argv);
}

Eclipse's CDT reported this one, and it is a bug:
the loop increment logic is incorrect for dcc_argv_search, as "a = a++" is undefined.     It should just be "a++"

int dcc_argv_search(char **a,
                    const char *needle)
{
    for (; *a; a = a++) // should be a++
        if (!strcmp(*a, needle))
            return 1;
    return 0;
}

Both functions are in argutil.c
-Michael
__ 
distcc mailing list            http://distcc.samba.org/
To unsubscribe or change options: 
https://lists.samba.org/mailman/listinfo/distcc

Reply via email to