Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 5, 2008, 11:14:45 AM (17 years ago)
Author:
scheusso
Message:

took out some mallocs and replaced them with new

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network3/src/network/PacketDecoder.cc

    r1232 r1233  
    181181    if(currentState->compsize==0)
    182182      COUT(2) << "PacketDecoder: compsize is 0" << std::endl;
    183     currentState->data = (unsigned char*)(malloc( currentState->compsize ));
     183//     currentState->data = (unsigned char*)(malloc( currentState->compsize ));
     184    currentState->data = new unsigned char[currentState->compsize];
    184185    if(currentState->data==NULL)
    185186      COUT(2) << "PacketDecoder: Gamestatepacket-decoder: memory leak" << std::endl;
     
    198199    cid->id = ((classid *)(packet->data))->id;
    199200    cid->clid = ((classid *)(packet->data))->clid;
    200     cid->message = (const char *)malloc(cid->length);
     201//     cid->message = (const char *)malloc(cid->length);
     202    cid->message = new char[cid->length];
    201203    void *data  = (void *)cid->message;
    202204    memcpy(data, (const void*)(packet->data+3*sizeof(int)), cid->length);
Note: See TracChangeset for help on using the changeset viewer.