]> sigrok.org Git - libsigrok.git/commitdiff
tekpower-dmm: Drop unneeded g_try_malloc().
authorUwe Hermann <redacted>
Wed, 28 Nov 2012 16:14:42 +0000 (17:14 +0100)
committerUwe Hermann <redacted>
Sun, 2 Dec 2012 13:21:17 +0000 (14:21 +0100)
hardware/tekpower-dmm/protocol.c

index f1d01feeff42a7b425c5f9d988d0cee0c4e57c30..cc7dea8f190f4f2bc402982a91a7bec94ce691e6 100644 (file)
@@ -53,17 +53,11 @@ static void fs9721_serial_handle_packet(const uint8_t *buf,
                return;
        }
 
-       if (!(analog->data = g_try_malloc(sizeof(float)))) {
-               sr_err("Analog value malloc failed.");
-               g_free(analog);
-               return;
-       }
-
        analog->num_samples = 1;
        analog->mq = -1;
 
        sr_fs9721_parse(buf, &floatval, analog, &info);
-       *analog->data = floatval;
+       analog->data = &floatval;
 
        if (is_temperature) {
                analog->mq = SR_MQ_TEMPERATURE;
@@ -79,7 +73,6 @@ static void fs9721_serial_handle_packet(const uint8_t *buf,
                devc->num_samples++;
        }
 
-       g_free(analog->data);
        g_free(analog);
 }