Skip to content

Memory leak in Davix 0.8.11 #145

@amadio

Description

@amadio

Commit c47c9ee introduced a change moving a buffer from the stack into the heap. Unfortunately, between the call to malloc to allocate the buffer, and the call to free to release it, there is a place where an exception can be thrown and leak memory:

buffer = (char*)malloc(s_buff+1);
const dav_ssize_t ret = req->readSegment(buffer, s_buff, &tmp_err);
checkDavixError(&tmp_err);
if(ret >= 0){
buffer[ret]= '\0';
parser->parseChunk(buffer, ret);
}else{
throw DavixException(scope, StatusCode::UnknownError, "Unknown readSegment error");
}
free(buffer);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions