Commit 1f3b4bd6 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Fix TopPath_DoBusinessToPath leaking memory on error

Detail:
  s/TopPath - Code which attempted to free the cleaned up user's path incorrectly assumed that it could find the string via the stacked R0. However stacked regs R0-R6 get updated with the found objects details, so we need to store a copy of the users R0 elsewhere and free the string via that instead.
Admin:
  Fixes OS_FSControl 37 (and other operations?) filling the system heap if given paths which will generate errors (e.g. if drive empty/missing)


Version 2.76. Tagged as 'FileSwitch-2_76'
parent c91b0634
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.75"
Module_Version SETA 275
Module_MajorVersion SETS "2.76"
Module_Version SETA 276
Module_MinorVersion SETS ""
Module_Date SETS "20 Feb 2012"
Module_ApplicationDate SETS "20-Feb-12"
Module_Date SETS "09 Apr 2012"
Module_ApplicationDate SETS "09-Apr-12"
Module_ComponentName SETS "FileSwitch"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/FileSwitch"
Module_FullVersion SETS "2.75"
Module_HelpVersion SETS "2.75 (20 Feb 2012)"
Module_FullVersion SETS "2.76"
Module_HelpVersion SETS "2.76 (09 Apr 2012)"
END
/* (2.75)
/* (2.76)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.75
#define Module_MajorVersion_CMHG 2.76
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 20 Feb 2012
#define Module_Date_CMHG 09 Apr 2012
#define Module_MajorVersion "2.75"
#define Module_Version 275
#define Module_MajorVersion "2.76"
#define Module_Version 276
#define Module_MinorVersion ""
#define Module_Date "20 Feb 2012"
#define Module_Date "09 Apr 2012"
#define Module_ApplicationDate "20-Feb-12"
#define Module_ApplicationDate "09-Apr-12"
#define Module_ComponentName "FileSwitch"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/FileSwitch"
#define Module_FullVersion "2.75"
#define Module_HelpVersion "2.75 (20 Feb 2012)"
#define Module_LibraryVersionInfo "2:75"
#define Module_FullVersion "2.76"
#define Module_HelpVersion "2.76 (09 Apr 2012)"
#define Module_LibraryVersionInfo "2:76"
......@@ -86,6 +86,7 @@ TopPath_WantPartition * 1:SHL:7
^ 0, sp
FSPath_Context # 4
Appendment # 4 ; Path tail to append to prefix(es) from path variable(s)
CleanedUpPath # 4 ; Copy of R0 on entry
TopPath_ContextSize # 0
TopPath_DoBusinessToPath Entry "r7"
......@@ -97,6 +98,7 @@ TopPath_DoBusinessToPathFSPrefix Entry "r0-r9",:INDEX:TopPath_ContextSize
DREG r6, "DoBusinessToPath r6 in is "
]
MOV r7, r4
STR r0, CleanedUpPath
; Copy path from user space to my space, cleaning it up as we go
BL TopPath_CopyCleanTransAndPoliceWithError
......@@ -476,7 +478,7 @@ TopPath_DoBusinessToPathFSPrefix Entry "r0-r9",:INDEX:TopPath_ContextSize
MOV r1, r0
; Junk the cleaned-up path
LDR r0, [sp, #Proc_LocalStack + 0*4]
LDR r0, CleanedUpPath
BL SFreeLinkedString
[ debugpath
LDR r0, globalerror
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment