ret = libusb_init(&context->libusb_ctx);
if (LIBUSB_SUCCESS != ret) {
sr_err("libusb_init() returned %s.\n", libusb_error_name(ret));
+ ret = SR_ERR;
goto done;
}
#endif
*ctx = context;
+ context = NULL;
ret = SR_OK;
done:
+ if (context)
+ g_free(context);
return ret;
}