× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This morning, I got a call about a problem with a program that was based on 
RPGDB2SAMP blowing up. It turns out that one of the XML documents it was 
parsing was not well formed (it had an un-escaped & in it but that's another 
bug in another program). Since this happened once before with malformed XML 
(and I was still pretty cheesed at getting paged early on a Monday morning), I 
decided that I was going to fix the dang thing or die trying.

To make a long story short, RPGDB2SAMP does not check to see if there were any 
errors parsing the document prior to calling routine FreeElem. If you only 
process a few XML documents with it before the one with an error or the bad one 
is the first one, the pointer to it's linked list of elements is null and it 
causes no problems (FreeElem does check for nulls). If you process a mess of 
documents (it was about 120 or so this morning before the one with the error), 
FreeElem ends up with the pointer to one of the linked list entries from the 
previous document. The memory it's pointing to has already be de-allocated by 
the prior call to FreeElem so when it tries to do it again, the program blows 
up.

Once I saw what was happening, the fix was very simple. Instead of this:

c                   callp     FreeElem

It should be this:

c                   If        Qxml_ErrorType = 0
c                   callp     FreeElem
c                   EndIf

Matt


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.