aboutsummaryrefslogtreecommitdiff
path: root/src/librc-misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/librc-misc.c')
-rw-r--r--src/librc-misc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librc-misc.c b/src/librc-misc.c
index d5b66b02..9390a748 100644
--- a/src/librc-misc.c
+++ b/src/librc-misc.c
@@ -90,7 +90,7 @@ char **rc_config_load (const char *file)
{
char **list = NULL;
FILE *fp;
- char buffer[RC_LINEBUFFER];
+ char *buffer;
char *p;
char *token;
char *line;
@@ -104,6 +104,7 @@ char **rc_config_load (const char *file)
if (! (fp = fopen (file, "r")))
return (NULL);
+ buffer = xmalloc (sizeof (char) * RC_LINEBUFFER);
while (fgets (buffer, RC_LINEBUFFER, fp)) {
p = buffer;
@@ -164,6 +165,7 @@ char **rc_config_load (const char *file)
}
free (entry);
}
+ free (buffer);
fclose (fp);
return (list);
@@ -189,7 +191,7 @@ librc_hidden_def(rc_config_value)
char **rc_config_list (const char *file)
{
FILE *fp;
- char buffer[RC_LINEBUFFER];
+ char *buffer;
char *p;
char *token;
char **list = NULL;
@@ -197,6 +199,7 @@ char **rc_config_list (const char *file)
if (! (fp = fopen (file, "r")))
return (NULL);
+ buffer = xmalloc (sizeof (char) * RC_LINEBUFFER);
while (fgets (buffer, RC_LINEBUFFER, fp)) {
p = buffer;
@@ -214,6 +217,7 @@ char **rc_config_list (const char *file)
rc_strlist_add (&list, token);
}
}
+ free (buffer);
fclose (fp);
return (list);