]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/saleae-logic16/api.c
Consistently use g_malloc0() for allocating devc.
[libsigrok.git] / src / hardware / saleae-logic16 / api.c
index f151fbd9243df42443c815052ab221a934b47841..21ccd557b69a6865e8d1a6962f221d41cf9c647a 100644 (file)
@@ -198,7 +198,7 @@ static GSList *scan(GSList *options)
                if (des.idVendor != LOGIC16_VID || des.idProduct != LOGIC16_PID)
                        continue;
 
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INITIALIZING;
                sdi->vendor = g_strdup("Saleae");
                sdi->model = g_strdup("Logic16");
@@ -212,8 +212,7 @@ static GSList *scan(GSList *options)
                        sdi->channels = g_slist_append(sdi->channels, ch);
                }
 
-               if (!(devc = g_try_malloc0(sizeof(struct dev_context))))
-                       return NULL;
+               devc = g_malloc0(sizeof(struct dev_context));
                devc->selected_voltage_range = VOLTAGE_RANGE_18_33_V;
                sdi->priv = devc;
                drvc->instances = g_slist_append(drvc->instances, sdi);