From: Gerhard Sittig Date: Sun, 28 Oct 2018 08:36:11 +0000 (+0100) Subject: input/csv: improve cleanup code path, unbreak re-import X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=539188e52451d42a9962269135b9030aca19c902 input/csv: improve cleanup code path, unbreak re-import The cleanup() routine gets invoked upon shutdown, as well as before re-importing another file. The cleanup() routine must not release resources which get allocated in the init() routine, as the init() routine won't run again in the module's lifetime. The cleanup() routine must void those context fields which get evaluated in the next receive() calls. --- diff --git a/src/input/csv.c b/src/input/csv.c index fdfc2641..2fa6704d 100644 --- a/src/input/csv.c +++ b/src/input/csv.c @@ -889,14 +889,10 @@ static void cleanup(struct sr_input *in) inc = in->priv; - if (inc->delimiter) - g_string_free(inc->delimiter, TRUE); - - if (inc->comment) - g_string_free(inc->comment, TRUE); - g_free(inc->termination); + inc->termination = NULL; g_free(inc->datafeed_buffer); + inc->datafeed_buffer = NULL; } static int reset(struct sr_input *in)