]> sigrok.org Git - libsigrok.git/blobdiff - src/backend.c
Use g_malloc0() consistently, simplify error handling.
[libsigrok.git] / src / backend.c
index 6500bf54d484446582a6be9b6366d85d9be909f4..637f7de99aaf3dbfc4696b6894c39f94095821d1 100644 (file)
@@ -348,12 +348,7 @@ SR_API int sr_init(struct sr_context **ctx)
        }
 
        /* + 1 to handle when struct sr_context has no members. */
-       context = g_try_malloc0(sizeof(struct sr_context) + 1);
-
-       if (!context) {
-               ret = SR_ERR_MALLOC;
-               goto done;
-       }
+       context = g_malloc0(sizeof(struct sr_context) + 1);
 
 #ifdef HAVE_LIBUSB_1_0
        ret = libusb_init(&context->libusb_ctx);