Fix memory-leak at the processing of multiple calendars.

Found with:   Coverity Prevent(tm)
CID:          7085
This commit is contained in:
Edwin Groothuis 2010-06-05 11:12:35 +00:00
parent 78c6c39d48
commit 7e63c265da
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208826

View File

@ -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 *