]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/ikalogic-scanaplus/api.c
Consistently use g_malloc0() for allocating devc.
[libsigrok.git] / src / hardware / ikalogic-scanaplus / api.c
index 5075364624946c4d48563f5c6e6f2b16f540614d..f3cd81201ab2e0d8a226d136bc76cddedcca8696 100644 (file)
@@ -88,10 +88,7 @@ static GSList *scan(GSList *options)
        devices = NULL;
 
        /* Allocate memory for our private device context. */
-       if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
-               sr_err("Device context malloc failed.");
-               goto err_free_nothing;
-       }
+       devc = g_malloc0(sizeof(struct dev_context));
 
        /* Allocate memory for the incoming compressed samples. */
        if (!(devc->compressed_buf = g_try_malloc0(COMPRESSED_BUF_SIZE))) {
@@ -123,7 +120,7 @@ static GSList *scan(GSList *options)
        }
 
        /* Register the device with libsigrok. */
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INITIALIZING;
        sdi->vendor = g_strdup(USB_VENDOR_NAME);
        sdi->model = g_strdup(USB_MODEL_NAME);
@@ -154,7 +151,6 @@ err_free_compressed_buf:
        g_free(devc->compressed_buf);
 err_free_devc:
        g_free(devc);
-err_free_nothing:
 
        return NULL;
 }