Hi all,

So in my dissector, i call a dll that allocates memory for information to be 
returned back for output, but when i try and free the memory, i get an error. I 
was wondering what the scope of the memory would be and where i should free it, 
maybe i'm freeing it wrong. I allocate it in my dll after if(tree) and free it 
at the end of the if statement. This is how i allocate:

        char * change = (char *)malloc(string.GetLength()+1);
        memset(change,0,string.GetLength()+1);
        ::strncpy_s(change, string.GetLength()+1, string, string.GetLength());
        return change;

and i just want to use free(variable); but i get:

HEAP[wireshark.exe]: Invalid Address specified to RtlFreeHeap( 027E0000, 
05E8F998 )
Windows has triggered a breakpoint in wireshark.exe.

This may be due to a corruption of the heap, which indicates a bug in 
wireshark.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while wireshark.exe has focus.

The output window may have more diagnostic information.

pointing to the:
::strncpy_s(change, string.GetLength()+1, string, string.GetLength()); 
line

Thanks for any help,

Greg
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to