]> sigrok.org Git - libsigrok.git/commitdiff
analog: Get GString content from proper API call
authorMarek Vasut <redacted>
Sat, 28 Oct 2023 07:12:48 +0000 (09:12 +0200)
committerGerhard Sittig <redacted>
Sat, 28 Oct 2023 09:14:02 +0000 (11:14 +0200)
Use the g_string_free() routine's return value instead of pulling the
string content out of the buffer structure bypassing the library's API.

Signed-off-by: Marek Vasut <redacted>
src/analog.c

index f5cc628500138f5a5dd901b3240629abbaf8dbfb..76ea659caf99ec54a33813a023c2d6a6f51279c8 100644 (file)
@@ -492,8 +492,7 @@ SR_API int sr_analog_unit_to_string(const struct sr_datafeed_analog *analog,
                if (analog->meaning->mqflags & mq_strings[i].value)
                        g_string_append(buf, mq_strings[i].str);
 
-       *result = buf->str;
-       g_string_free(buf, FALSE);
+       *result = g_string_free(buf, FALSE);
 
        return SR_OK;
 }