Imported Upstream version 1.13 upstream/1.13
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 19 Oct 2021 07:12:53 +0000 (16:12 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 19 Oct 2021 07:12:53 +0000 (16:12 +0900)
19 files changed:
ChangeLog
INSTALL
NEWS
README
buffer.c
carg_parser.c
carg_parser.h
configure
doc/ed.1
doc/ed.info
doc/ed.texi
ed.h
global.c
io.c
main.c
main_loop.c
regex.c
signal.c
testsuite/check.sh

index ca1c69d..4e63d63 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-01-24  Antonio Diaz Diaz  <antonio@gnu.org>
+
+       * Version 1.13 released.
+       * buffer.c (put_sbuf_line): Fixed a memory leak.
+       * io.c (read_file, write_file): Close file on error.
+         (Both issues reported by Cédric Picard).
+
 2015-07-04  Antonio Diaz Diaz  <antonio@gnu.org>
 
        * Version 1.12 released.
@@ -22,7 +29,7 @@
 2013-06-18  Antonio Diaz Diaz  <antonio@gnu.org>
 
        * Version 1.9 released.
-       * check.sh: Do not feed shell scripts to ed.
+       * check.sh: Don't feed shell scripts to ed.
        * configure: Options now accept a separate argument.
 
 2013-04-23  Antonio Diaz Diaz  <antonio@gnu.org>
@@ -224,7 +231,7 @@ Dec 1993  Fran
 
 Copyright (C) 1993 François Pinard
 Copyright (C) 1994 Andrew Moore
-Copyright (C) 2006-2015 Antonio Diaz Diaz.
+Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
 This file is a collection of facts, and thus it is not copyrightable,
 but just in case, you have unlimited permission to copy, distribute and
diff --git a/INSTALL b/INSTALL
index 170db71..18e7c6c 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -58,7 +58,7 @@ After running 'configure', you can run 'make' and 'make install' as
 explained above.
 
 
-Copyright (C) 2006-2015 Antonio Diaz Diaz.
+Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
 This file is free documentation: you have unlimited permission to copy,
 distribute and modify it.
diff --git a/NEWS b/NEWS
index 8b1428d..22f6186 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,4 @@
-Changes in version 1.12:
+Changes in version 1.13:
 
-Extra spaces have been removed from the synopses of some commands in the
-manual.
-
-Minor documentation fixes.
+A memory leak and a resource leak (file not closed on error) have been
+fixed. (Both issues were reported by Cédric Picard).
diff --git a/README b/README
index bc86c71..5f43db1 100644 (file)
--- a/README
+++ b/README
@@ -136,7 +136,7 @@ or:
 
 
 Copyright (C) 1993, 1994 Andrew Moore
-Copyright (C) 2006-2015 Antonio Diaz Diaz.
+Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
 This file is free documentation: you have unlimited permission to copy,
 distribute and modify it.
index a3e6f6e..b2121ce 100644 (file)
--- a/buffer.c
+++ b/buffer.c
@@ -1,7 +1,7 @@
 /* buffer.c: scratch-file buffer routines for the ed line editor. */
 /*  GNU ed - The GNU line editor.
     Copyright (C) 1993, 1994 Andrew Moore, Talke Studio
-    Copyright (C) 2006-2015 Antonio Diaz Diaz.
+    Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
     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
@@ -439,11 +439,10 @@ bool put_lines( const int addr )
 const char * put_sbuf_line( const char * const buf, const int size,
                             const int addr )
   {
-  line_t * const lp = dup_line_node( 0 );
   const char * const p = (const char *) memchr( buf, '\n', size );
+  line_t * lp;
   int len;
 
-  if( !lp ) return 0;
   if( !p ) { set_error_msg( "Line too long" ); return 0; }
   len = p - buf;
   /* out of position */
@@ -465,6 +464,8 @@ const char * put_sbuf_line( const char * const buf, const int size,
     set_error_msg( "Cannot write temp file" );
     return 0;
     }
+  lp = dup_line_node( 0 );
+  if( !lp ) return 0;
   lp->pos = sfpos; lp->len = len;
   add_line_node( lp, addr );
   ++current_addr_;
index 8d74ea6..3d4e89f 100644 (file)
@@ -1,5 +1,5 @@
 /*  Arg_parser - POSIX/GNU command line argument parser. (C version)
-    Copyright (C) 2006-2015 Antonio Diaz Diaz.
+    Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
     This library is free software. Redistribution and use in source and
     binary forms, with or without modification, are permitted provided
index ed4d9c5..e918942 100644 (file)
@@ -1,5 +1,5 @@
 /*  Arg_parser - POSIX/GNU command line argument parser. (C version)
-    Copyright (C) 2006-2015 Antonio Diaz Diaz.
+    Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
     This library is free software. Redistribution and use in source and
     binary forms, with or without modification, are permitted provided
index 51875c9..50f3cad 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,12 +1,12 @@
 #! /bin/sh
 # configure script for GNU ed - The GNU line editor
-# Copyright (C) 2006-2015 Antonio Diaz Diaz.
+# Copyright (C) 2006-2016 Antonio Diaz Diaz.
 #
 # This configure script is free software: you have unlimited permission
 # to copy, distribute and modify it.
 
 pkgname=ed
-pkgversion=1.12
+pkgversion=1.13
 progname=ed
 srctrigger=doc/${pkgname}.texi
 
@@ -143,7 +143,7 @@ if [ -z "${no_create}" ] ; then
        rm -f config.status
        cat > config.status << EOF
 #! /bin/sh
-# This file was generated automatically by configure. Do not edit.
+# This file was generated automatically by configure. Don't edit.
 # Run this file to recreate the current configuration.
 #
 # This script is free software: you have unlimited permission
@@ -170,8 +170,8 @@ echo "LDFLAGS = ${LDFLAGS}"
 rm -f Makefile
 cat > Makefile << EOF
 # Makefile for GNU ed - The GNU line editor
-# Copyright (C) 2006-2015 Antonio Diaz Diaz.
-# This file was generated automatically by configure. Do not edit.
+# Copyright (C) 2006-2016 Antonio Diaz Diaz.
+# This file was generated automatically by configure. Don't edit.
 #
 # This Makefile is free software: you have unlimited permission
 # to copy, distribute and modify it.
index bca3551..ac8b882 100644 (file)
--- a/doc/ed.1
+++ b/doc/ed.1
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.46.1.
-.TH ED "1" "July 2015" "ed 1.12" "User Commands"
+.TH ED "1" "January 2016" "ed 1.13" "User Commands"
 .SH NAME
 ed \- line-oriented text editor
 .SH SYNOPSIS
@@ -49,7 +49,7 @@ General help using GNU software: http://www.gnu.org/gethelp
 .SH COPYRIGHT
 Copyright \(co 1994 Andrew L. Moore.
 .br
-Copyright \(co 2015 Antonio Diaz Diaz.
+Copyright \(co 2016 Antonio Diaz Diaz.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 .br
 This is free software: you are free to change and redistribute it.
index 3b47ae7..a239faf 100644 (file)
@@ -5,7 +5,7 @@ START-INFO-DIR-ENTRY
 * Ed: (ed).                     The GNU line editor
 END-INFO-DIR-ENTRY
 
-   Copyright (C) 1993, 1994, 2006-2015 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 2006-2016 Free Software Foundation, Inc.
 
    Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -18,7 +18,7 @@ File: ed.info,  Node: Top,  Next: Overview,  Up: (dir)
 The GNU ed line editor
 **********************
 
-This manual is for GNU ed (version 1.12, 4 July 2015).
+This manual is for GNU ed (version 1.13, 24 January 2016).
 
 
    GNU ed is a line-oriented text editor. It is used to create, display,
@@ -43,7 +43,7 @@ superseded by full-screen editors such as GNU Emacs or GNU Moe.
 * GNU Free Documentation License::  How you can copy and share this manual
 
 
-   Copyright (C) 1993, 1994, 2006-2015 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 2006-2016 Free Software Foundation, Inc.
 
    Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -338,7 +338,7 @@ prefixed with a bang.
 
 '-l'
 '--loose-exit-status'
-     Do not exit with bad status if a command happens to "fail" (for
+     Don't exit with bad status if a command happens to "fail" (for
      example if a substitution command finds nothing to replace). This
      can be useful when 'ed' is invoked as the editor for crontab.
 
@@ -1412,16 +1412,16 @@ permit their use in free software.
 \1f
 Tag Table:
 Node: Top\7f535
-Node: Overview\7f2191
-Node: Introduction to line editing\7f4247
-Node: Invoking ed\7f11466
-Node: Line addressing\7f13267
-Node: Regular expressions\7f16344
-Node: Commands\7f21688
-Node: Limitations\7f32960
-Node: Diagnostics\7f33605
-Node: Problems\7f34306
-Node: GNU Free Documentation License\7f34839
+Node: Overview\7f2195
+Node: Introduction to line editing\7f4251
+Node: Invoking ed\7f11470
+Node: Line addressing\7f13270
+Node: Regular expressions\7f16347
+Node: Commands\7f21691
+Node: Limitations\7f32963
+Node: Diagnostics\7f33608
+Node: Problems\7f34309
+Node: GNU Free Documentation License\7f34842
 \1f
 End Tag Table
 
index 5059473..26fb2a9 100644 (file)
@@ -6,8 +6,8 @@
 @finalout
 @c %**end of header
 
-@set UPDATED 4 July 2015
-@set VERSION 1.12
+@set UPDATED 24 January 2016
+@set VERSION 1.13
 
 @dircategory Basics
 @direntry
@@ -15,7 +15,7 @@
 @end direntry
 
 @copying
-Copyright @copyright{} 1993, 1994, 2006-2015
+Copyright @copyright{} 1993, 1994, 2006-2016
 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
@@ -392,7 +392,7 @@ not seem familiar, then try invoking @command{ed} with this switch.
 
 @item -l
 @itemx --loose-exit-status
-Do not exit with bad status if a command happens to "fail" (for example
+Don't exit with bad status if a command happens to "fail" (for example
 if a substitution command finds nothing to replace). This can be useful
 when @command{ed} is invoked as the editor for crontab.
 
diff --git a/ed.h b/ed.h
index 43cd355..b7ccffb 100644 (file)
--- a/ed.h
+++ b/ed.h
@@ -1,7 +1,7 @@
 /*  Global declarations for the ed editor.  */
 /*  GNU ed - The GNU line editor.
     Copyright (C) 1993, 1994 Andrew Moore, Talke Studio
-    Copyright (C) 2006-2015 Antonio Diaz Diaz.
+    Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
     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
index 5e7def6..5a9c2e1 100644 (file)
--- a/global.c
+++ b/global.c
@@ -1,7 +1,7 @@
 /* global.c: global command routines for the ed line editor */
 /*  GNU ed - The GNU line editor.
     Copyright (C) 1993, 1994 Andrew Moore, Talke Studio
-    Copyright (C) 2006-2015 Antonio Diaz Diaz.
+    Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
     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
diff --git a/io.c b/io.c
index 548e7d3..bf7c154 100644 (file)
--- a/io.c
+++ b/io.c
@@ -1,7 +1,7 @@
 /* io.c: i/o routines for the ed line editor */
 /*  GNU ed - The GNU line editor.
     Copyright (C) 1993, 1994 Andrew Moore, Talke Studio
-    Copyright (C) 2006-2015 Antonio Diaz Diaz.
+    Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
     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
@@ -261,8 +261,8 @@ int read_file( const char * const filename, const int addr )
     return -1;
     }
   size = read_stream( fp, addr );
-  if( size < 0 ) return -1;
   if( *filename == '!' ) ret = pclose( fp ); else ret = fclose( fp );
+  if( size < 0 ) return -1;
   if( ret != 0 )
     {
     show_strerror( filename, errno );
@@ -319,8 +319,8 @@ int write_file( const char * const filename, const char * const mode,
     return -1;
     }
   size = write_stream( fp, from, to );
-  if( size < 0 ) return -1;
   if( *filename == '!' ) ret = pclose( fp ); else ret = fclose( fp );
+  if( size < 0 ) return -1;
   if( ret != 0 )
     {
     show_strerror( filename, errno );
diff --git a/main.c b/main.c
index ff7e4a2..915aa8b 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1,5 +1,5 @@
 /*  GNU ed - The GNU line editor.
-    Copyright (C) 2006-2015 Antonio Diaz Diaz.
+    Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
     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
@@ -44,7 +44,7 @@
 
 static const char * const Program_name = "GNU Ed";
 static const char * const program_name = "ed";
-static const char * const program_year = "2015";
+static const char * const program_year = "2016";
 static const char * invocation_name = 0;
 
 static bool restricted_ = false;       /* if set, run in restricted mode */
index 0d118cc..a4c8914 100644 (file)
@@ -1,6 +1,6 @@
 /*  GNU ed - The GNU line editor.
     Copyright (C) 1993, 1994 Andrew Moore, Talke Studio
-    Copyright (C) 2006-2015 Antonio Diaz Diaz.
+    Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
     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
diff --git a/regex.c b/regex.c
index 4a5f2b3..2ca49ce 100644 (file)
--- a/regex.c
+++ b/regex.c
@@ -1,7 +1,7 @@
 /* regex.c: regular expression interface routines for the ed line editor. */
 /*  GNU ed - The GNU line editor.
     Copyright (C) 1993, 1994 Andrew Moore, Talke Studio
-    Copyright (C) 2006-2015 Antonio Diaz Diaz.
+    Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
     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
index 18a3873..63ba1cc 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -1,7 +1,7 @@
 /* signal.c: signal and miscellaneous routines for the ed line editor. */
 /*  GNU ed - The GNU line editor.
     Copyright (C) 1993, 1994 Andrew Moore, Talke Studio
-    Copyright (C) 2006-2015 Antonio Diaz Diaz.
+    Copyright (C) 2006-2016 Antonio Diaz Diaz.
 
     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
index 9a7e35b..81ee128 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # check script for GNU ed - The GNU line editor
-# Copyright (C) 2006-2015 Antonio Diaz Diaz.
+# Copyright (C) 2006-2016 Antonio Diaz Diaz.
 #
 # This script is free software; you have unlimited permission
 # to copy, distribute and modify it.