diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-11 20:46:00 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-16 22:58:43 -0800 |
commit | fecb1f5a0c2121de6d9209fc9525ac7d9b9555ea (patch) | |
tree | bb5b722eac41a1717e6f0b0e424b0b29f47ec96d /pf.c | |
parent | 66c09c83aa2f64b31dc657f90447c269621545b7 (diff) |
Free copy of input line at end of process_line instead of leaking it
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'pf.c')
-rw-r--r-- | pf.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -30,6 +30,7 @@ from The Open Group. #include <X11/Xlib.h> #include <stdio.h> #include <ctype.h> +#include <stdlib.h> #include "xmodmap.h" #define NOTINFILEFILENAME "commandline" @@ -96,11 +97,11 @@ void process_line (const char *line) register char c = buffer[i]; if (!(isspace(c) || c == '\n')) break; } - if (i == len) return; + if (i == len) goto done; cp = &buffer[i]; - if (*cp == '!') return; /* look for comments */ + if (*cp == '!') goto done; /* look for comments */ len -= (cp - buffer); /* adjust len by how much we skipped */ /* pipe through cpp */ @@ -118,4 +119,7 @@ void process_line (const char *line) /* handle input */ handle_line (cp, len); + + done: + free(buffer); } |