cbrtl-ieee: Work around test failure on IRIX 6.5.
[gnulib.git] / lib / readtokens.c
index e29f20e..705a62b 100644 (file)
@@ -1,6 +1,6 @@
 /* readtokens.c  -- Functions for reading tokens from an input stream.
 
-   Copyright (C) 1990-1991, 1999-2004, 2006, 2009-2010 Free Software
+   Copyright (C) 1990-1991, 1999-2004, 2006, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -18,7 +18,7 @@
 
    Written by Jim Meyering. */
 
-/* This almost supercedes xreadline stuff -- using delim="\n"
+/* This almost supersedes xreadline stuff -- using delim="\n"
    gives the same functionality, except that these functions
    would never return empty lines. */
 
@@ -143,7 +143,7 @@ readtoken (FILE *stream,
    All storage is obtained through calls to xmalloc-like functions.
 
    %%% Question: is it worth it to do a single
-   %%% realloc() of `tokens' just before returning? */
+   %%% realloc() of 'tokens' just before returning? */
 
 size_t
 readtokens (FILE *stream,
@@ -197,5 +197,7 @@ readtokens (FILE *stream,
   *tokens_out = tokens;
   if (token_lengths != NULL)
     *token_lengths = lengths;
+  else
+    free (lengths);
   return n_tokens;
 }