[Osip] error: datatype misalignment when sending INVITE

samkol chea sophysamkol at hotmail.com
Thu Jun 26 15:08:47 CEST 2008


Thank you for your fast response Aymeric,

The "datatype misalignment" error occurs only randomly only about 10 to 20%. However, it happens only in the function used to send the INVITE message. 

The error log is ALWAYS like this:

        Data Abort: Thread=827a2bc8 Proc=80278e70 'PROJECT WM5.exe'
        AKY=00080001 PC=03f817b0(coredll.dll+0x000217b0) RA=50616548(???+0x50616548) BVA=3823382e FSR=00000003
        Unhandled exception at 0x03f817b0 in PROJECT WM5.exe: 0x80000002: Datatype misalignment.

which breaks at line 948 of the file "osip_port.c", at the function osip_free (void * ptr). So, I guess there is something to do with release the memory allocation.

And here is my code to send the INVITE message:
(Note, that I have to convert the IP address from string type to char * type)

BOOL inviteAS(string IPAddrStr)
{
    int i;
    i = eXosip_init();
    if (i != 0)
        return FALSE;
    char *IPAddrChar = new char[IPAddrStr.length() + 1];

    // Manual copy str to char[]
    for(int x = 0; x<IPAddrStr.length(); x++)
        IPAddrChar[x] = IPAddrStr[x];

    IPAddrChar[IPAddrStr.length()] = '\0';

    i = eXosip_listen_addr(IPPROTO_UDP, IPAddrChar, 5060, AF_INET, 0);
    if (i != 0)
    {
        eXosip_quit();
        return FALSE;
    }
    osip_message_t __unaligned *invite = NULL;
    
    m = eXosip_call_build_initial_invite(&invite, "<sip:as at 172.31.32.11:5060>",
                                                        "<sip:user02 at ims.nsn.com>",
                                                        "<sip:as at 64.194.100.111:5060>",
                                                        "");
    
    osip_message_set_content_type (invite, "application/sdp");

    eXosip_lock();
    m = eXosip_call_send_initial_invite (invite);
    eXosip_unlock();
    eXosip_event_t __unaligned *te = NULL;
    osip_message_t __unaligned *ack = NULL;
    int w;
    int count = 0;
    for(;;)
    {
        te = eXosip_event_wait(0,50);
        eXosip_lock();
        eXosip_automatic_action();
        eXosip_unlock();
        if(te == NULL)
        {
            count++;
            if (count > 50)
            {
                m = eXosip_call_send_initial_invite (invite);
                count = 0;
            }
            continue;
        }
        else if (te->type == EXOSIP_CALL_PROCEEDING)
        {
            continue;
        }    
        else if (te->type ==EXOSIP_CALL_ANSWERED)
        {
            w = eXosip_call_build_ack(te->did, &ack); 
            w = eXosip_call_send_ack(te->did, ack);
            osip_message_free(ack);
            break;
        }
    }
    eXosip_event_free(te);
    osip_message_free(invite);    
    delete []IPAddrChar;
    eXosip_quit();
    return TRUE;
}

Thanks for your previous reply,
Sam

> Date: Thu, 26 Jun 2008 11:19:37 +0200
> From: jack at atosc.org
> To: sophysamkol at hotmail.com
> CC: osip at atosc.org
> Subject: Re: [Osip] error: datatype misalignment when sending INVITE
> 
> 
> 
> On Wed, 25 Jun 2008, samkol chea wrote:
> 
> >
> > Hi,
> >
> > I'm working with Windows Mobile 5.0 SDK Visual Studio 2005 C++. When I 
> > send an INVITE message, sometimes, the program crashes with "datatype 
> > misalignment error". The error occurs at the same location in memory, 
> > but at different location in program. I tried putting the keyword 
> > "__unaligned" infront of some pointers such as "osip_message_t *", and 
> > "eXosip_event_t *", but it does not help me. The frequent of this error 
> > is about 20%. Has anyone experienced this issue before?
> 
> I'm using WM5 and VS2005 with no issue.
> 
> Aymeric MOIZARD / ANTISIP
> amsip - http://www.antisip.com
> osip2 - http://www.osip.org
> eXosip2 - http://savannah.nongnu.org/projects/exosip/
> 
> 
> > Thanks,
> > Sam
> >
> >
> >
> > _________________________________________________________________
> >
> > _______________________________________________
> > Osip mailing list
> > Osip at atosc.org
> > http://www.atosc.org/mailinglist/listinfo/osip
> >

_________________________________________________________________



More information about the Osip mailing list