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.
This commit is contained in:
Gerhard Sittig 2018-10-28 09:36:11 +01:00
parent 17c30d0593
commit 539188e524
1 changed files with 2 additions and 6 deletions

View File

@ -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)