We were misreporting a failure to ctf_dict_open the dict as
an out-of-memory error.
ctf_dict_open_cached (ctf_archive_t *arc, const char *name, int *errp)
{
ctf_dict_t *fp;
- char *dupname;
+ char *dupname = NULL;
/* Just return from the cache if possible. */
if (arc->ctfi_dicts
}
/* Not yet cached: open it. */
- fp = ctf_dict_open (arc, name, errp);
- dupname = strdup (name);
+ if ((fp = ctf_dict_open (arc, name, errp)) == NULL)
+ goto err;
- if (!fp || !dupname)
+ if ((dupname = strdup (name)) == NULL)
goto oom;
if (arc->ctfi_dicts == NULL)
return fp;
oom:
- ctf_dict_close (fp);
- free (dupname);
if (errp)
*errp = ENOMEM;
+ err:
+ ctf_dict_close (fp);
+ free (dupname);
return NULL;
}