diff options
author | Roy Marples <roy@marples.name> | 2007-10-12 00:01:33 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-10-12 00:01:33 +0000 |
commit | 20a149b2c7bfd7e53d24d0665281c083d7362c67 (patch) | |
tree | b195111871b8e05c584b71aed066c3990c5db2b3 /src/rc-misc.c | |
parent | e3bc6666d6d5bd8922ca10652a2d04577357fa71 (diff) |
malloc over fatty buffers
Diffstat (limited to 'src/rc-misc.c')
-rw-r--r-- | src/rc-misc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rc-misc.c b/src/rc-misc.c index 60f8009a..1012f57c 100644 --- a/src/rc-misc.c +++ b/src/rc-misc.c @@ -132,7 +132,7 @@ char **env_filter (void) static bool file_regex (const char *file, const char *regex) { FILE *fp; - char buffer[RC_LINEBUFFER]; + char *buffer; regex_t re; bool retval = false; int result; @@ -140,10 +140,12 @@ static bool file_regex (const char *file, const char *regex) if (! (fp = fopen (file, "r"))) return (false); + buffer = xmalloc (sizeof (char) * RC_LINEBUFFER); if ((result = regcomp (&re, regex, REG_EXTENDED | REG_NOSUB)) != 0) { fclose (fp); - regerror (result, &re, buffer, sizeof (buffer)); + regerror (result, &re, buffer, RC_LINEBUFFER); fprintf (stderr, "file_regex: %s", buffer); + free (buffer); return (false); } @@ -154,6 +156,7 @@ static bool file_regex (const char *file, const char *regex) break; } } + free (buffer); fclose (fp); regfree (&re); |