]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/lascar-el-usb/protocol.c
Consistently use g_malloc0() for allocating devc.
[libsigrok.git] / src / hardware / lascar-el-usb / protocol.c
index 49c5cd0a3687e3416c8585edd72c1634cca7e204..c18357b35278068f72f078ef9a0b81f8954308f7 100644 (file)
@@ -323,9 +323,11 @@ static struct sr_dev_inst *lascar_identify(unsigned char *config)
                        return NULL;
                }
 
-               if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, LASCAR_VENDOR,
-                               profile->modelname, firmware)))
-                       return NULL;
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
+               sdi->status = SR_ST_INACTIVE;
+               sdi->vendor = g_strdup(LASCAR_VENDOR);
+               sdi->model = g_strdup(profile->modelname);
+               sdi->version = g_strdup(firmware);
                sdi->driver = di;
 
                if (profile->logformat == LOG_TEMP_RH) {
@@ -346,8 +348,7 @@ static struct sr_dev_inst *lascar_identify(unsigned char *config)
                        sdi->channels = g_slist_append(NULL, ch);
                }
 
-               if (!(devc = g_try_malloc0(sizeof(struct dev_context))))
-                       return NULL;
+               devc = g_malloc0(sizeof(struct dev_context));
                sdi->priv = devc;
                devc->profile = profile;
        }