summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/stream.c2
-rw-r--r--tools/omfile.c15
2 files changed, 8 insertions, 9 deletions
diff --git a/runtime/stream.c b/runtime/stream.c
index bfeecee5..e8805a40 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -722,7 +722,7 @@ CODESTARTobjDestruct(strm)
free(pThis->pZipBuf);
free(pThis->pszCurrFName);
free(pThis->pszFName);
-
+ pThis->bStopWriter = 2; /* RG: use as flag for destruction */
ENDobjDestruct(strm)
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;