Author: edwin
Date: Sat Jun  5 11:12:35 2010
New Revision: 208826
URL: http://svn.freebsd.org/changeset/base/208826

Log:
  Fix memory-leak at the processing of multiple calendars.
  
  Found with:   Coverity Prevent(tm)
  CID:          7085

Modified:
  head/usr.bin/calendar/io.c

Modified: head/usr.bin/calendar/io.c
==============================================================================
--- head/usr.bin/calendar/io.c  Sat Jun  5 11:06:56 2010        (r208825)
+++ head/usr.bin/calendar/io.c  Sat Jun  5 11:12:35 2010        (r208826)
@@ -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 *
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to