------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1209




--- Comment #4 from Rhodri Jenkins <[email protected]>  2012-02-28 15:32:49 ---
Hi Philip

Yes I did resolve this in a fashion. What I did was add a new function 
which I exported from the pcre3.dll. This was void pcre_free_regex (void * 
ptr) which call free internally.

This function just calls free internally on the pointer to the regex 
structure  I got from pcre_compile. The reason why I need to do this I 
believe is that I am calling pcre from C#. There were not way I could find 
to call pcre_free successfully because its is a function pointer and I 
could not free up the structure pointer because it is allocated on the 
unmanaged memory space. The simple exported function pcre_free_regex 
worked just fine.

The other problem I encountered in the windows build files supplied fro 
MSVC 2008 do not contain the necessary link and manifest settings to 
generate a manifest file. Without a manifest the dll will generate a c run 
time access error when it attempts to lad the msvcr80.dll. I played around 
with this for quite a while and I got past the msvcr80.dll load issue then 
it fell over again trying to load another dependent dll, either 
kernel32.dll or ntldll.dll. In the end I migrated the project from MSVC 
2008 to MSVC 2010 which allows you to load dll's without a manifest which 
is much easier to achieve.

If you are interest in these changes I can supply the amended code with 
some instructions. There is basically one extra c file with a three line 
function pcre_free_regex.. A function prototype for this function in 
pcre.h and migrated solution and project files.

Rhodri Jenkins
Application Architect

07901715788

CSC ? This is a PRIVATE message. If you are not the intended recipient, 
please delete without copying and kindly advise us by e-mail of the 
mistake in delivery.  NOTE: Regardless of content, this e-mail shall not 
operate to bind CSC to any order or other contract unless pursuant to 
explicit written agreement or government initiative expressly permitting 
the use of e-mail for such purpose ? CSC Computer Sciences Limited ? 
Registered Office: Royal Pavilion, Wellesley Road, Aldershot, Hampshire, 
GU11 1PZ, UK ? Registered in England No: 0963578




From:   Philip Hazel <[email protected]>
To:     Rhodri L Jenkins/GBR/CSC@CSC
Date:   28/02/2012 15:09
Subject:        [Bug 1209] Calling pcre_free from C# causes a memory 
access violation
Sent by:        [email protected]



------- You are receiving this mail because: -------
You are on the CC list for the bug.
You reported the bug.

http://bugs.exim.org/show_bug.cgi?id=1209




--- Comment #3 from Philip Hazel <[email protected]>  2012-02-28 
15:11:56 ---
> This might be a basic question but if pcre_free is a function pointer is 

> this used to supply a function pointer to the pcre code to be called 
when 
> the pcre dll needs to delete the compiled  pcre structure returned from 
> pcre_compile? Am I correct to assume that I need to free the pcre 
> structure returned by pcre_compile to avoid a memory leak?

Did you manage to resolve this? I so, I would like to close this issue. By
default, pcre_free is a pointer to the system function free(), just as
pcre_malloc points to malloc(). They are indirected so that applications 
can
catch them if they need to.

Philip


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/pcre-dev 

Reply via email to