diff options
Diffstat (limited to 'libvxi11client/perlbits')
-rw-r--r-- | libvxi11client/perlbits/perlglue.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libvxi11client/perlbits/perlglue.c b/libvxi11client/perlbits/perlglue.c index dafc707..5c9f4c2 100644 --- a/libvxi11client/perlbits/perlglue.c +++ b/libvxi11client/perlbits/perlglue.c @@ -49,11 +49,17 @@ static void interruptcallback(gchar* handle) { */ VXI11Context* glue_open(char* address, char* device) { - VXI11Context* context = malloc(sizeof(VXI11Context)); + VXI11Context* context = g_malloc(sizeof(VXI11Context)); if (context == NULL ) return NULL ; - int err = vxi11_open(context, address, device); + int ret = vxi11_open(context, address, device); + // if the connection fails dump the context and return null + // so perl can see what happened + if (ret < 1) { + g_free(context); + context = NULL; + } return context; } |