aboutsummaryrefslogtreecommitdiff
path: root/src/librc-misc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-12 00:01:33 +0000
committerRoy Marples <roy@marples.name>2007-10-12 00:01:33 +0000
commit20a149b2c7bfd7e53d24d0665281c083d7362c67 (patch)
treeb195111871b8e05c584b71aed066c3990c5db2b3 /src/librc-misc.c
parente3bc6666d6d5bd8922ca10652a2d04577357fa71 (diff)
malloc over fatty buffers
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);