From ee1a47c7b3ee397b9ee8e8d13512affb6ead33c0 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 24 Jan 2013 11:05:45 +0900 Subject: Copy the buffer into a fresh allocation and free the copy in globals.. --- libvxi11client/README | 2 +- vxi11_server.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libvxi11client/README b/libvxi11client/README index 71d5153..b09e63f 100644 --- a/libvxi11client/README +++ b/libvxi11client/README @@ -31,7 +31,7 @@ perl's XS functionality (http://perldoc.perl.org/perlxs.html). The guts of this are are perlbits/Client.xs. There are then some perl wrapper functions to help with pulling arguments out of a hash and passing it to the XS code. -This are in perlbits/Client.pm. +These are in perlbits/Client.pm. The perl module has one more requirement; ExtUtils::PkgConfig. This is only used at build time and is used to find where 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 { -- cgit