Browse Source

Fixed pcre pointer free. (#43)

Brucey 6 months ago
parent
commit
ade12f7f5e
2 changed files with 12 additions and 6 deletions
  1. 2 1
      regex.mod/common.bmx
  2. 10 5
      regex.mod/regex.bmx

+ 2 - 1
regex.mod/common.bmx

@@ -1,4 +1,4 @@
-' Copyright (c) 2007-2024 Bruce A Henderson
+' Copyright (c) 2007-2025 Bruce A Henderson
 ' All rights reserved.
 '
 ' Redistribution and use in source and binary forms, with or without
@@ -385,6 +385,7 @@ Extern
 
 	Function pcre2_compile_16:Byte Ptr(pattern:Short Ptr, patternLength:Size_T, options:Int, errorcodeptr:Int Ptr, ..
 		erroffset:Size_T Ptr, contextptr:Byte Ptr)
+	Function pcre2_code_free_16(code:Byte Ptr)
 	Function pcre2_match_16:Int(pattern:Byte Ptr, subject:Byte Ptr, subjectLength:Size_T, startOffset:Size_T, ..
 		options:Int, matchPtr:Byte Ptr, context:Byte Ptr)
 	Function pcre2_substring_get_bynumber_16:Int(matchPtr:Byte Ptr, stringnumber:Int, ..

+ 10 - 5
regex.mod/regex.bmx

@@ -1,4 +1,4 @@
-' Copyright (c) 2007-2024 Bruce A Henderson
+' Copyright (c) 2007-2025 Bruce A Henderson
 ' All rights reserved.
 '
 ' Redistribution and use in source and binary forms, with or without
@@ -30,12 +30,14 @@ bbdoc: Regular Expressions
 End Rem
 Module Text.RegEx
 
-ModuleInfo "Version: 1.12"
+ModuleInfo "Version: 1.13"
 ModuleInfo "Author: PCRE - Philip Hazel"
 ModuleInfo "License: BSD"
 ModuleInfo "Copyright: PCRE - 1997-2021 University of Cambridge"
-ModuleInfo "Copyright: Wrapper - 2007-2024 Bruce A Henderson"
+ModuleInfo "Copyright: Wrapper - 2007-2025 Bruce A Henderson"
 
+ModuleInfo "History: 1.13"
+ModuleInfo "History: Fixed free of pcre pointer."
 ModuleInfo "History: 1.12"
 ModuleInfo "History: Updated to PCRE 10.43"
 ModuleInfo "History: Options are now configured per search. Default options are used if none provided."
@@ -126,14 +128,17 @@ Type TRegEx
 		
 		If TArg Then
 			MemFree(TArg)
+			TArg = Null
 		End If
 		
 		If matchPtr Then
 			pcre2_match_data_free_16(matchPtr)
+			matchPtr = Null
 		End If
 		
 		If pcre
-			MemFree(pcre)
+			pcre2_code_free_16(pcre)
+			pcre = Null
 		EndIf
 		
 	End Method
@@ -419,7 +424,7 @@ Type TRegEx
 		
 		If bptr Then
 			If pcre
-				MemFree(pcre)
+				pcre2_code_free_16(pcre)
 			EndIf
 			
 			pcre = bptr