RFR-8008118
Martin Buchholz
martinrb at google.com
Thu Mar 21 17:26:25 UTC 2013
On Thu, Mar 21, 2013 at 10:10 AM, Martin Buchholz <martinrb at google.com>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.
More information about the core-libs-dev
mailing list