From 1429b21db812b591699341712af2f1dd448363c5 Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Wed, 16 Oct 2013 14:21:05 +0200 Subject: [PATCH 1/1] Key strings passed to decoder options must be newly allocated --- pv/prop/binding/decoderoptions.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pv/prop/binding/decoderoptions.cpp b/pv/prop/binding/decoderoptions.cpp index 435d5f6d..dc3a8e97 100644 --- a/pv/prop/binding/decoderoptions.cpp +++ b/pv/prop/binding/decoderoptions.cpp @@ -80,8 +80,10 @@ GVariant* DecoderOptions::getter(const char *id) { const srd_decoder_option *const opt = (srd_decoder_option*)l->data; - if (strcmp(opt->id, id) == 0) + if (strcmp(opt->id, id) == 0) { val = opt->def; + break; + } } } @@ -94,7 +96,7 @@ GVariant* DecoderOptions::getter(const char *id) void DecoderOptions::setter(const char *id, GVariant *value) { g_variant_ref(value); - g_hash_table_insert(_options, (void*)id, value); + g_hash_table_insert(_options, (void*)g_strdup(id), value); } } // binding -- 2.30.2