If `foo` doesn&#x27;t own `buf`, it should be declared `char * const` (or `char const * const`). If `foo` takes owner ship of `buf` (and is intended to free it), it should take a pointer to the pointer to clear it for the caller. This is one way to write it:<p><pre><code>    void foo(char **const bufptr) {
        ...
        free(*bufptr); *bufptr = NULL;
    }
</code></pre>
You can dereference `bufptr` at the top of the function to make the code more readable. This is how (almost) every object freeing function works in my project.