Skip to content
Snippets Groups Projects
  • Michael Davis's avatar
    f3c38aba
    [ssi_af_ls] Corrects memory allocation for Data/Stream responses · f3c38aba
    Michael Davis authored
    In the case of a Stream response, XRootD allocates the memory and
    manipulates the buffer pointer. In the case of a Data response, we need
    to allocate the buffer ourselves. In both cases, the buffer is treated
    in ProcessResponseData(), which does not care how the buffer was filled.
    
    This requires a bit of extra logic to make sure the buffer is
    deallocated for Data responses but not Stream responses. I have done
    this using a unique pointer to allocate a char[] for Data responses.
    and char *m_buffer_ptr points to the memory allocated.
    
    We never delete m_buffer_ptr as memory allocation is handled either
    by the unique_ptr or by XRoot and we don't care which.
    f3c38aba
    History
    [ssi_af_ls] Corrects memory allocation for Data/Stream responses
    Michael Davis authored
    In the case of a Stream response, XRootD allocates the memory and
    manipulates the buffer pointer. In the case of a Data response, we need
    to allocate the buffer ourselves. In both cases, the buffer is treated
    in ProcessResponseData(), which does not care how the buffer was filled.
    
    This requires a bit of extra logic to make sure the buffer is
    deallocated for Data responses but not Stream responses. I have done
    this using a unique pointer to allocate a char[] for Data responses.
    and char *m_buffer_ptr points to the memory allocated.
    
    We never delete m_buffer_ptr as memory allocation is handled either
    by the unique_ptr or by XRoot and we don't care which.