summaryrefslogtreecommitdiffstats
path: root/tools/omfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/omfile.c')
-rw-r--r--tools/omfile.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/tools/omfile.c b/tools/omfile.c
index ae5f350d..91bcf0c2 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -286,19 +286,18 @@ dynaFileDelCacheEntry(dynaFileCacheEntry **pCache, int iEntry, int bFreeEntry)
DBGPRINTF("Removed entry %d for file '%s' from dynaCache.\n", iEntry,
pCache[iEntry]->pName == NULL ? UCHAR_CONSTANT("[OPEN FAILED]") : pCache[iEntry]->pName);
-// RG: check the "open failed" case -- can this cause trouble (but do we have that situation?)
- /* if the name is NULL, this is an improperly initialized entry which
- * needs to be discarded. In this case, neither the file is to be closed
- * nor the name to be freed.
- */
+
if(pCache[iEntry]->pName != NULL) {
- if(pCache[iEntry]->pStrm != NULL)
- strm.Destruct(&pCache[iEntry]->pStrm);
-// RG: pStrm should now be NULL...
d_free(pCache[iEntry]->pName);
pCache[iEntry]->pName = NULL;
}
+ if(pCache[iEntry]->pStrm != NULL) {
+ strm.Destruct(&pCache[iEntry]->pStrm);
+ if(pCache[iEntry]->pStrm != NULL) /* safety check -- TODO: remove if no longer necessary */
+ abort();
+ }
+
if(bFreeEntry) {
d_free(pCache[iEntry]);
pCache[iEntry] = NULL;