X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Fdata-list.c;h=3ee524d5b80001b7ad7e7c81eb3e0d206f5dd48b;hb=707848060e414fe93458834446dd7cdbf800667f;hp=6ca829fc5ab7d75d5459c58d1d828436cc5d5c3c;hpb=a5a1e8c05118edd5d9fd0dfd1a6f421632779292;p=pspp diff --git a/src/language/data-io/data-list.c b/src/language/data-io/data-list.c index 6ca829fc5a..3ee524d5b8 100644 --- a/src/language/data-io/data-list.c +++ b/src/language/data-io/data-list.c @@ -120,7 +120,7 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds) struct dictionary *dict; struct data_list_pgm *dls; int table = -1; /* Print table if nonzero, -1=undecided. */ - struct file_handle *fh = fh_inline_file (); + struct file_handle *fh = NULL; struct pool *tmp_pool; bool ok; @@ -143,6 +143,7 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds) if (lex_match_id (lexer, "FILE")) { lex_match (lexer, '='); + fh_unref (fh); fh = fh_parse (lexer, FH_REF_FILE | FH_REF_INLINE); if (fh == NULL) goto error; @@ -244,6 +245,8 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds) } } + if (fh == NULL) + fh = fh_inline_file (); fh_set_default_handle (fh); if (dls->type == -1) @@ -292,10 +295,12 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds) } pool_destroy (tmp_pool); + fh_unref (fh); return CMD_SUCCESS; error: + fh_unref (fh); data_list_trns_free (dls); return CMD_CASCADING_FAILURE; }