tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fix netbsd32's getfh()



In article <53AB0471.4080209%M00nBSD.net@localhost>,
Maxime Villard  <max%M00nBSD.net@localhost> wrote:
>> 
>> That should probably be:
>> 
>>              return error;
>> 
>> since vfs_composefh_alloc() failed, and we should not be calling 
>> vfs_composefh_free().
>
>Yes, but no. Actually, vfs_composefh_free() handles NULL correctly,
>and that's what the native code does. I know it's an evil design.

Well, let's not propagate the evil design! I is is one thing having:

        void *p = malloc(n);
        free(p);

where you know p is going to be NULL when it fails and another having:

        foo *p;
        error = allocate_foo(&p);
        free_foo(p);

and expect p to be altered in the error path of allocate_foo.

Please, let's fix it! I volunteer :-)

christos



Home | Main Index | Thread Index | Old Index