Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Jun 2010 11:12:35 +0000 (UTC)
From:      Edwin Groothuis <edwin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r208826 - head/usr.bin/calendar
Message-ID:  <201006051112.o55BCZp7006047@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 *



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006051112.o55BCZp7006047>