From: Uwe Hermann Date: Wed, 28 Nov 2012 16:14:42 +0000 (+0100) Subject: tekpower-dmm: Drop unneeded g_try_malloc(). X-Git-Tag: dsupstream~518 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d84fc9cb3b9fede9234603f95c1467f95686c1a7;p=libsigrok.git tekpower-dmm: Drop unneeded g_try_malloc(). --- diff --git a/hardware/tekpower-dmm/protocol.c b/hardware/tekpower-dmm/protocol.c index f1d01fee..cc7dea8f 100644 --- a/hardware/tekpower-dmm/protocol.c +++ b/hardware/tekpower-dmm/protocol.c @@ -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); }