two resource leaks in 2.5.3

Julien ÉLIE julien at trigofacile.com
Tue Jun 18 18:33:32 UTC 2013


Hi David,

> Static analysis tool "cppcheck" found the following two resource leaks
> 
> [clientactive.c:77]: (error) Resource leak: F
> 
> [nnrpd/misc.c:338]: (error) Resource leak: fp
> 
> I've checked them both and they look like leaks to me.

Thanks again for your report.

They also look like leaks.
Aren't there 3 leaks in nnrpd/misc.c and not only 1 at line 338?


--- lib/clientactive.c	(révision 9475)
+++ lib/clientactive.c	(copie de travail)
@@ -74,6 +74,7 @@
 	if (strcmp(CApathname, pathname) == 0)
             CAclose();
 	errno = oerrno;
+       fclose(F);
 	return NULL;
     }




--- nnrpd/misc.c	(révision 9475)
+++ nnrpd/misc.c	(copie de travail)
@@ -335,6 +335,7 @@
      if (fgets(buff,SMBUF,fp) == NULL) {
        syslog(L_ERROR, "%s Error reading '%s': %s",
               Client.host, path, strerror(errno));
+       fclose(fp);
        return 0;
      }
      *lastpost = atol(buff);
@@ -342,6 +343,7 @@
      if ((s = strchr(buff,',')) == NULL) {
        syslog(L_ERROR, "%s bad data in postrec file: '%s'",
               Client.host, buff);
+       fclose(fp);
        return 0;
      }
      s++; *lastsleep = atol(s);
@@ -349,6 +351,7 @@
      if ((s = strchr(s,',')) == NULL) {
        syslog(L_ERROR, "%s bad data in postrec file: '%s'",
               Client.host, buff);
+       fclose(fp);
        return 0;
      }
      s++; *lastn = atol(s);






-- 
Julien ÉLIE

« Aliud est celare, aliud tacere. »


More information about the inn-workers mailing list