Sync OpenBSD patchset 233:

Don't leak in the (rare) case of an invalid command at the end of a file not
terminated by a \n.
This commit is contained in:
Tiago Cunha 2009-08-09 17:53:50 +00:00
parent 4c944910fa
commit 1297c39a31

4
cfg.c
View File

@ -1,4 +1,4 @@
/* $Id: cfg.c,v 1.19 2009-07-30 21:07:23 tcunha Exp $ */ /* $Id: cfg.c,v 1.20 2009-08-09 17:53:50 tcunha Exp $ */
/* /*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@ -112,6 +112,8 @@ load_cfg(const char *path, char **cause)
return (0); return (0);
error: error:
if (line != NULL)
xfree(line);
fclose(f); fclose(f);
xasprintf(&ptr, "%s: %s at line %u", path, *cause, n); xasprintf(&ptr, "%s: %s at line %u", path, *cause, n);