summaryrefslogtreecommitdiffstats
path: root/usr.bin/calendar
diff options
context:
space:
mode:
authoredwin <edwin@FreeBSD.org>2010-06-05 11:12:35 +0000
committeredwin <edwin@FreeBSD.org>2010-06-05 11:12:35 +0000
commit387baf087f842f48a31472c0b70ce96117d69153 (patch)
treead7524e49b0ef5eb495b98d7d047d6a31c5beb46 /usr.bin/calendar
parent81217ca03a6fc1439145e101cc896eff085a3549 (diff)
downloadFreeBSD-src-387baf087f842f48a31472c0b70ce96117d69153.zip
FreeBSD-src-387baf087f842f48a31472c0b70ce96117d69153.tar.gz
Fix memory-leak at the processing of multiple calendars.
Found with: Coverity Prevent(tm) CID: 7085
Diffstat (limited to 'usr.bin/calendar')
-rw-r--r--usr.bin/calendar/io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c
index 2b1a26f..ef98d5d 100644
--- a/usr.bin/calendar/io.c
+++ b/usr.bin/calendar/io.c
@@ -107,8 +107,10 @@ cal(void)
tm.tm_wday = 0;
count = 0;
- if ((fp = opencal()) == NULL)
+ if ((fp = opencal()) == NULL) {
+ free(extradata);
return;
+ }
while (fgets(buf, sizeof(buf), stdin) != NULL) {
if ((pp = strchr(buf, '\n')) != NULL)
*pp = '\0';
@@ -203,6 +205,7 @@ cal(void)
event_print_all(fp);
closecal(fp);
+ free(extradata);
}
FILE *
OpenPOWER on IntegriCloud