diff options
-rw-r--r-- | vxi11_server.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index 2d1a455..f367694 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -254,16 +254,20 @@ device_write_1_svc(Device_WriteParms *argp, struct svc_req *rqstp) { else { touchlink(argp->lid); links[argp->lid]->aborted = false; - gchar* str = g_strndup(argp->data.data_val, argp->data.data_len); -#ifdef DEBUG - int n; - for (n = 0; str[n] != '\0'; n++) - printf("%02x ", (unsigned char) str[n]); - printf("\n"); - printf("got <<%s>> (reported length %d)on link %d.\n", str, (int) argp->data.data_len, (int) argp->lid); -#endif - Parser_main(str, 0, GPIB_and_VXI_start_query_response, NULL ); - g_free(str); + gchar* str = NULL; + if (argp->data.data_val != NULL ) + str = g_strndup(argp->data.data_val, argp->data.data_len); + if (str != NULL ) { +#ifdef DEBUG + int n; + for (n = 0; str[n] != '\0'; n++) + printf("%02x ", (unsigned char) str[n]); + printf("\n"); + printf("got <<%s>> (reported length %d)on link %d.\n", str, (int) argp->data.data_len, (int) argp->lid); +#endif + Parser_main(str, 0, GPIB_and_VXI_start_query_response, NULL ); + g_free(str); + } result.size = argp->data.data_len; } @@ -277,7 +281,7 @@ device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) { printf("device_read_1_svc()\n"); #endif - // this free's the data from the last call +// this free's the data from the last call if (result.data.data_val != NULL ) g_free(result.data.data_val); @@ -549,8 +553,8 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { printf("Client %s is asking for an interrupt connection on port %u\n", clientaddressstring, (unsigned int) port); #endif - // if a client had an interrupt channel and died without closing it - // we need to clean it up to avoid a deadlock +// if a client had an interrupt channel and died without closing it +// we need to clean it up to avoid a deadlock static struct rpc_err err; if (intclient != NULL ) { vxi11_fireinterrupt(); |