diff options
author | daniel <danieruru@gmail.com> | 2013-01-24 11:05:45 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-24 11:05:45 +0900 |
commit | ee1a47c7b3ee397b9ee8e8d13512affb6ead33c0 (patch) | |
tree | 0ab6295f616001c00dab48cafc0e4cd66faad222 /vxi11_server.c | |
parent | edeb612f557063c4855dfd9285c6eba29b5d6906 (diff) |
Copy the buffer into a fresh allocation and free the copy in globals..
Diffstat (limited to 'vxi11_server.c')
-rw-r--r-- | vxi11_server.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index 1faa821..741b3fb 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -184,10 +184,13 @@ device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) { } else { if (globals.Registers.pending_output_message != NULL) { - result.data.data_val = globals.Registers.pending_output_message; - result.data.data_len = strlen(result.data.data_val) + 1; + result.data.data_len = strlen(globals.Registers.pending_output_message) + 1; + result.data.data_val = calloc(result.data.data_len, 1); + strncpy(result.data.data_val, globals.Registers.pending_output_message, result.data.data_len); + g_free(globals.Registers.pending_output_message); + globals.Registers.pending_output_message = NULL; #ifdef DEBUG - printf("sending ---%s---\n", globals.Registers.pending_output_message); + printf("sending ---%s---\n", result.data.data_val); #endif } else { |