*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.129 2004/08/29 05:06:43 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.130 2004/09/18 01:22:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* Tokenize file and handle file inclusion and comma lists. We have
* to break apart the commas to expand any file names then
* reconstruct with commas.
+ *
+ * The result is always a palloc'd string. If it's zero-length then
+ * we have reached EOL.
*/
static char *
next_token_expand(FILE *file)
do
{
next_token(file, buf, sizeof(buf));
- if (!*buf)
+ if (!buf[0])
break;
if (buf[strlen(buf) - 1] == ',')
buf = next_token_expand(file);
/* add token to list, unless we are at EOL or comment start */
- if (buf[0] != '\0')
+ if (buf[0])
{
if (current_line == NIL)
{
current_line = NIL;
/* Advance line number whenever we reach EOL */
line_number++;
+ /* Don't forget to pfree the next_token_expand result */
+ pfree(buf);
}
}
}