]> sigrok.org Git - libsigrok.git/blobdiff - hardware/fx2lafw/fx2lafw.c
sr/srd/cli: require glib version >= 2.28
[libsigrok.git] / hardware / fx2lafw / fx2lafw.c
index 2c0c6360164a70f37a59aedd93950a154dec298a..6b184b70d8f9ff0178dca18f1aa49b3609a7dd08 100644 (file)
@@ -328,7 +328,7 @@ static int configure_probes(struct context *ctx, GSList *probes)
                        continue;
 
                if (probe->index > 8)
-                       ctx->sample_wide = true;
+                       ctx->sample_wide = TRUE;
 
                probe_bit = 1 << (probe->index - 1);
                if (!(probe->trigger))
@@ -706,6 +706,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
        /* Fire off a new request. */
        if (!(new_buf = g_try_malloc(4096))) {
                sr_err("fx2lafw: %s: new_buf malloc failed.", __func__);
+               libusb_free_transfer(transfer);
                return; /* TODO: SR_ERR_MALLOC */
        }
 
@@ -726,6 +727,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
                         */
                        abort_acquisition(ctx);
                }
+               g_free(cur_buf);
                return;
        } else {
                empty_transfer_count = 0;
@@ -794,14 +796,13 @@ static void receive_transfer(struct libusb_transfer *transfer)
 
        if (ctx->trigger_stage == TRIGGER_FIRED) {
                /* Send the incoming transfer to the session bus. */
-               const trigger_offset_bytes = trigger_offset * sample_width;
+               const int trigger_offset_bytes = trigger_offset * sample_width;
                packet.type = SR_DF_LOGIC;
                packet.payload = &logic;
                logic.length = transfer->actual_length - trigger_offset_bytes;
                logic.unitsize = sample_width;
                logic.data = cur_buf + trigger_offset_bytes;
                sr_session_send(ctx->session_dev_id, &packet);
-               g_free(cur_buf);
 
                ctx->num_samples += cur_sample_count;
                if (ctx->limit_samples &&
@@ -814,6 +815,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
                 * ratio-sized buffer.
                 */
        }
+       g_free(cur_buf);
 }
 
 static int hw_dev_acquisition_start(int dev_index, void *cb_data)