On Thu, Mar 21, 2013 at 10:10 AM, Martin Buchholz <[email protected]>wrote:
>
> if (pathv[i] == NULL) {
> for (i--; i >= 0; i--)
> free(pathv[i]);
> return NULL;
> }
>
>
Alan correctly points out that you can't free "./".
static const char * const cwd = "./";
...
if (pathv[i] == NULL) {
for (i--; i >= 0; i--)
if (pathv[i] != cwd)
free(pathv[i]);
return NULL;
}
Manual memory management is a drag.
