Move the reading of the deleted flag so that it picks up any changes.
Notw we need a value on the stack because the object might get
freed and we don't want to access a hanging pointer.
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
int yaffs_DeleteFile(yaffs_Object *in)
{
int retVal = YAFFS_OK;
- int deleted = in->deleted;
+ int deleted; /* Need to cache value on stack if in is freed */
yaffs_Device *dev = in->myDev;
if (dev->param.disableSoftDelete || dev->param.isYaffs2)
if (!in->unlinked)
retVal = yaffs_UnlinkFileIfNeeded(in);
+ deleted = in->deleted;
+
if (retVal == YAFFS_OK && in->unlinked && !in->deleted) {
in->deleted = 1;
deleted = 1;