Send inn-workers mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.isc.org/mailman/listinfo/inn-workers
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of inn-workers digest..."


Today's Topics:

   1. Re: timecaf/caf.c:1568: use of variable after free (Julien ?LIE)
   2. Re: two resource leaks in 2.5.3 (Julien ?LIE)


----------------------------------------------------------------------

Message: 1
Date: Tue, 18 Jun 2013 19:47:06 +0200
From: Julien ?LIE <[email protected]>
To: [email protected]
Subject: Re: timecaf/caf.c:1568: use of variable after free
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi David,

> cppcheck also found this little problem:
>
> [timecaf/caf.c:1568]: (error) Dereferencing 'newpath' after it is deallocated 
> /  released
>
> Source code is
>
>          free(newpath);
>          fclose(infile);
>          unlink(newpath);

Thanks for your report.  It is a real bug, though it should not happen 
often.  This code is triggered when fseeko fails because of a previous 
write that may have failed.


> Suggest put unlink before free.

As the file (whose path is newpath) still has not been created, the fix 
here is to remove the call to unlink.

-- 
Julien ?LIE

? Aliud est celare, aliud tacere. ?


------------------------------

Message: 2
Date: Tue, 18 Jun 2013 20:33:32 +0200
From: Julien ?LIE <[email protected]>
To: [email protected]
Subject: Re: two resource leaks in 2.5.3
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

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. ?


------------------------------

_______________________________________________
inn-workers mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/inn-workers

End of inn-workers Digest, Vol 52, Issue 5
******************************************

Reply via email to