Changeset 1761

Show
Ignore:
Timestamp:
08/21/08 10:16:40 (3 months ago)
Author:
xkovah
Message:

I stepped a little way through the soap code which wraps nsreceiveFileBase64, and saw it trying to dereference the encodedData pointer, which I had already delete[]ed. Thus I shouldn't delete that, and will just hope that the auto-generated soap code is deleting it properly, and not leaking the memory. It makes sense though that it needs to stay around until after the serializer has scooped all of the sweet and juicy data from the encodedData rind.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • capture-mod/trunk/CaptureSoapServer.cpp

    r1760 r1761  
    156156 
    157157int ns__receiveFileBase64(struct soap *soap, char * fileName, ns__receiveFileStruct &result){ 
    158     printf("in ns__receiveFileBase64, about to open %s\n", fileName); 
     158    int debug = 0; 
     159     
     160    if(debug) printf("in ns__receiveFileBase64, about to open %s\n", fileName); 
    159161 
    160162    //Open the file 
     
    173175    } 
    174176    char * buffer = new char[fileSize]; 
     177    memset(buffer, 0, fileSize); 
    175178 
    176179    DWORD numRead = 0; 
     
    181184    } 
    182185    else{ 
    183         printf("Read the file successfully\n"); 
     186        if(debug) printf("Read the file successfully\n"); 
    184187    } 
    185188 
    186189    //base64 the file 
    187     unsigned int encodedLength = b64::b64_encode(buffer, fileSize, NULL, NULL); 
     190    unsigned int encodedLength = (unsigned int)b64::b64_encode(buffer, fileSize, NULL, NULL); 
     191    if(debug) printf("encodedLength = %d\n", encodedLength); 
    188192    char * encodedData = new char[encodedLength]; 
     193    memset(encodedData, 0, encodedLength); 
    189194    size_t ret = b64::b64_encode(buffer, fileSize, encodedData, encodedLength); 
    190195    if(ret == 0){ 
     
    198203    result.decodedLength = fileSize; 
    199204 
    200     printf("cleaning up\n"); 
     205    if(debug) printf("cleaning up\n"); 
    201206    CloseHandle(myHandle); 
    202207    delete[] buffer; 
    203     delete[] encodedData; 
     208    //Don't delete[] encodedData because the SOAP stuff will need to grab the data from there for sending 
     209    //I'm just hoping that it deletes the memory and doesn't leak it 
     210    if(debug) printf("cleaned up successfully\n"); 
    204211 
    205212    return SOAP_OK; 
  • capture-mod/trunk/client.pl

    r1760 r1761  
    8787close(BLA); 
    8888 
    89 print "ns__myStruct.first = " . $som->result . "\n"; 
    90 print "ns__myStruct.last = " . ($som->paramsout)[0] . "\n"; 
     89#print "ns__myStruct.first = " . $som->result . "\n"; 
     90#print "ns__myStruct.last = " . ($som->paramsout)[0] . "\n"; 
    9191 
    92 my @params = $som->paramsall; 
    93 foreach $param (@params){ 
    94     print "$param\n"; 
    95  
    96 
     92#my @params = $som->paramsall; 
     93#foreach $param (@params){ 
     94#    print "$param\n"; 
     95
     96#
    9797 
    9898