[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with the Free function.



Hello,
 
I am having trouble with the ESNACC defined function that will free the entire structure (DataInterChange) used to encode Tap3 data. Here is the definition of DataInterChange.
 
typedef struct DataInterChange /* CHOICE */
{
    enum DataInterChangeChoiceId
    {
        DATAINTERCHANGE_TRANSFERBATCH,
        DATAINTERCHANGE_NOTIFICATION
    } choiceId;
    union DataInterChangeChoiceUnion
    {
        struct TransferBatch* transferBatch; /* TransferBatch */
        struct Notification* notification; /* Notification */
    } a;
} DataInterChange
;
 
I have a variable defined in my program as follows: DataInterChange sData;
 
Here is the ESNACC defined free function:
void FreeDataInterChange(DataInterChange *v); 
 
void FreeDataInterChange(DataInterChange *v)
{
 
        if(v == NULL)
                return;
        switch(v->choiceId)
    {
           case DATAINTERCHANGE_TRANSFERBATCH:
        FreeTransferBatch(v->a.transferBatch);
        Asn1Free ((v->a.transferBatch));
 
        break;
 
           case DATAINTERCHANGE_NOTIFICATION:
        FreeNotification(v->a.notification);
        Asn1Free ((v->a.notification));
 
        break;
 
        }
}  /* FreeDataInterChange */
 
Here is the call to that function that I use: FreeDataInterChange(&sData);
 
I guess I am a little confused as to why I get a "Segmentation Fault". I am able to use the ESNACC defined print function which has the exact same parameters as the free. That works fine, but the free does not.
 
Has anyone ran into this or does anyone have any suggestions?
 
Thanks,
Cory
Cory Schanzenbach___________________
Senior Software Specialist
National Information Solutions Cooperative
3201 Nygren Drive
Mandan, ND 58554
Email: cory.schanzenbach@xxxxxxxxx
Phone: 866.WWW.NISC (866.999.6472)