Fixed segmentation fault in case of much XML output
Because of the multi telegrams it is impossible to use a fixed buffer for XML output on the stack. Now the buffer is allocated on the heap. These also leads to a change in return behaviour for all XML functions, because it's possible that the buffer is NULL. For variable data this buffer grows every time there are less than 1024 bytes left for a new record.
This commit is contained in:
@ -169,7 +169,9 @@ main(int argc, char **argv)
|
||||
fprintf(stderr, "Failed to generate XML representation of MBUS frames: %s\n", mbus_error_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("%s", xml_result);
|
||||
free(xml_result);
|
||||
|
||||
mbus_disconnect(handle);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user