X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-text-file.c;h=e9aa8a3b1603bf4f252ca6e4932f6cf3a23fef41;hb=6a4b99242da1222b711790926aa6be41ad8adb3f;hp=590455d90e49151bc040dcb70d448fc90633a288;hpb=e0dffb4260d17aa199047cccf8423a5f92d633d6;p=pspp diff --git a/src/ui/gui/psppire-text-file.c b/src/ui/gui/psppire-text-file.c index 590455d90e..e9aa8a3b16 100644 --- a/src/ui/gui/psppire-text-file.c +++ b/src/ui/gui/psppire-text-file.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2017 Free Software Foundation + Copyright (C) 2017, 2020 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,6 @@ enum enum {MAX_LINE_LEN = 16384}; /* Max length of an acceptable line. */ - static void read_lines (PsppireTextFile *tf) { @@ -78,7 +77,7 @@ read_lines (PsppireTextFile *tf) tf->file_name, MAX_LINE_LEN); line_reader_close (reader); for (i = 0; i < tf->line_cnt; i++) - g_free (&tf->lines[i]); + g_free (tf->lines[i].string); tf->line_cnt = 0; ds_destroy (&input); return; @@ -88,7 +87,7 @@ read_lines (PsppireTextFile *tf) = recode_substring_pool ("UTF-8", line_reader_get_encoding (reader), input.ss, NULL); - } + } ds_destroy (&input); if (tf->line_cnt == 0) @@ -97,7 +96,7 @@ read_lines (PsppireTextFile *tf) msg (ME, _("`%s' is empty."), tf->file_name); line_reader_close (reader); for (i = 0; i < tf->line_cnt; i++) - g_free (&tf->lines[i]); + g_free (tf->lines[i].string); tf->line_cnt = 0; goto done; } @@ -304,7 +303,6 @@ __tree_model_get_flags (GtkTreeModel *model) static gint __tree_model_get_n_columns (GtkTreeModel *tree_model) { - PsppireTextFile *tf = PSPPIRE_TEXT_FILE (tree_model); return 2; } @@ -514,6 +512,9 @@ psppire_text_file_finalize (GObject *object) { PsppireTextFile *tf = PSPPIRE_TEXT_FILE (object); + for (int i = 0; i < tf->line_cnt; i++) + g_free (tf->lines[i].string); + g_free (tf->encoding); g_free (tf->file_name);