From 812d0f700694bad063545e67186172bed6ebcfc0 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sun, 23 Sep 2018 12:49:41 +0200 Subject: [PATCH] MATRIX DATA: Fix memory leaks --- src/language/data-io/matrix-data.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/language/data-io/matrix-data.c b/src/language/data-io/matrix-data.c index 609e5eb1fd..6beb19b1fb 100644 --- a/src/language/data-io/matrix-data.c +++ b/src/language/data-io/matrix-data.c @@ -125,8 +125,7 @@ preprocess (struct casereader *casereader0, const struct dictionary *dict, void { struct matrix_format *mformat = aux; const struct caseproto *proto = casereader_get_proto (casereader0); - struct casewriter *writer; - writer = autopaging_writer_create (proto); + struct casewriter *writer = autopaging_writer_create (proto); struct ccase *prev_case = NULL; double **matrices = NULL; size_t n_splits = 0; @@ -176,6 +175,8 @@ preprocess (struct casereader *casereader0, const struct dictionary *dict, void msg (SE, _("There are %d variable declared but the data has at least %d matrix rows."), mformat->n_continuous_vars, row + 1); + case_unref (c); + casereader_destroy (pass0); goto error; } int col; @@ -346,6 +347,7 @@ error: free (matrices[i]); free (matrices); casereader_destroy (casereader0); + casewriter_destroy (writer); return NULL; } @@ -558,7 +560,8 @@ cmd_matrix (struct lexer *lexer, struct dataset *ds) } else { - data_parser_make_active_file (parser, ds, reader, dict, preprocess, &mformat); + data_parser_make_active_file (parser, ds, reader, dict, preprocess, + &mformat); } fh_unref (fh); -- 2.30.2