]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/link-mso19/api.c
Consistently use g_malloc0() for allocating devc.
[libsigrok.git] / src / hardware / link-mso19 / api.c
index 29a5952ac03587a153fa9cfa9ce15b1596984b2d..5112fe285d2d0103b41e9c1b5f4f4421ce1c63f4 100644 (file)
@@ -178,10 +178,7 @@ static GSList *scan(GSList *options)
 
                //Create the device context and set its params
                struct dev_context *devc;
-               if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
-                       sr_err("Device context malloc failed.");
-                       return devices;
-               }
+               devc = g_malloc0(sizeof(struct dev_context));
 
                if (mso_parse_serial(iSerial, iProduct, devc) != SR_OK) {
                        sr_err("Invalid iSerial: %s.", iSerial);
@@ -203,8 +200,11 @@ static GSList *scan(GSList *options)
                        return devices;
                }
 
-               struct sr_dev_inst *sdi = sr_dev_inst_new(SR_ST_INACTIVE,
-                                               manufacturer, product, hwrev);
+               struct sr_dev_inst *sdi = g_malloc0(sizeof(struct sr_dev_inst));
+               sdi->status = SR_ST_INACTIVE;
+               sdi->vendor = g_strdup(manufacturer);
+               sdi->model = g_strdup(product);
+               sdi->version = g_strdup(hwrev);
 
                if (!sdi) {
                        sr_err("Unable to create device instance for %s",