Commit a2dff745 authored by 's avatar
Browse files

check for memory allocation in mapi_read_results(DiMAPI) & add...

check for memory allocation in mapi_read_results(DiMAPI) & add hashsamp_client_init in order to call hashsamp_client_read_result

git-svn-id: file:///home/svn/mapi/trunk@896 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 71017736
......@@ -1793,6 +1793,9 @@ 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
results[currhost].res = realloc(results[currhost].res, 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;
......
......@@ -366,6 +366,9 @@ static int hashsamp_client_read_result(mapidflib_function_instance_t *instance,m
return 0;
}
static int hashsamp_client_init(MAPI_UNUSED mapidflib_function_instance_t *instance, MAPI_UNUSED void* data){
return 0;
}
static mapidflib_function_def_t finfo={
"", //libname
......@@ -384,7 +387,7 @@ static mapidflib_function_def_t finfo={
NULL, //get_result
NULL, //reset
hashsamp_cleanup,
NULL, //client_init
hashsamp_client_init, //client_init
hashsamp_client_read_result,
NULL //client_cleanup
};
......
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