Commit 41c64c0b authored by 's avatar
Browse files

check for memory allocation in mapi_read_results(DiMAPI)

git-svn-id: file:///home/svn/mapi/trunk@897 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent a2dff745
......@@ -1793,9 +1793,10 @@ mapi_results_t* mapi_read_results(int fd, int fid)
hflow=(host_flow*)fnode->data;
switch(hflow->dbuf->cmd) {
case READ_RESULT_ACK:
if ((int)(hflow->dbuf->length - BASIC_SIZE) > results[currhost].size) // check memory allocation
if ( hflow->dbuf->length - BASIC_SIZE > (unsigned int)results[currhost].size ) { // check memory allocation
results[currhost].res = realloc(results[currhost].res, hflow->dbuf->length-BASIC_SIZE);
results[currhost].size=hflow->dbuf->length-BASIC_SIZE;
results[currhost].size = hflow->dbuf->length-BASIC_SIZE;
}
memcpy(results[currhost].res, hflow->dbuf->data, hflow->dbuf->length-BASIC_SIZE);
results[currhost].ts = hflow->dbuf->timestamp;
results[currhost].size = hflow->dbuf->length-BASIC_SIZE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment