about summary refs log tree commit diff
path: root/locale/programs
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-06-03 21:00:49 +0000
committerRoland McGrath <roland@gnu.org>1996-06-03 21:00:49 +0000
commit20328c396217915d148013fd8f119aeb9ed2da0c (patch)
tree8f64b0d2322adb143f6d2ebf4d23bafe92ac00ab /locale/programs
parent9f195df2d7f9e4f43d74b704092ead780df625b4 (diff)
downloadglibc-20328c396217915d148013fd8f119aeb9ed2da0c.tar.gz
glibc-20328c396217915d148013fd8f119aeb9ed2da0c.tar.xz
glibc-20328c396217915d148013fd8f119aeb9ed2da0c.zip
Sun Jun 2 20:14:30 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
	* locale/programs/linereader.c (lr_open): Don't pass NULL to
	xstrdup; fix memory leak.
	(lr_close): Fix memory leak.
Diffstat (limited to 'locale/programs')
-rw-r--r--locale/programs/linereader.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index e4a1305712..68508dff0c 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -66,7 +66,7 @@ lr_open (const char *fname, kw_hash_fct_t hf)
   result = (struct linereader *) xmalloc (sizeof (*result));
 
   result->fp = fp;
-  result->fname = xstrdup (fname);
+  result->fname = xstrdup (fname ? : "<stdin>");
   result->buf = NULL;
   result->bufsize = 0;
   result->lineno = 1;
@@ -80,6 +80,7 @@ lr_open (const char *fname, kw_hash_fct_t hf)
     {
       int save = errno;
       fclose (result->fp);
+      free (result->fname);
       free (result);
       errno = save;
       return NULL;
@@ -107,6 +108,7 @@ void
 lr_close (struct linereader *lr)
 {
   fclose (lr->fp);
+  free (lr->fname);
   free (lr->buf);
   free (lr);
 }