[Bugme-new] [Bug 13670] New: Resource leaks in objstrip.c

bugzilla-daemon at bugzilla.kernel.org bugzilla-daemon at bugzilla.kernel.org
Mon Jun 29 00:56:46 PDT 2009


http://bugzilla.kernel.org/show_bug.cgi?id=13670

           Summary: Resource leaks in objstrip.c
           Product: Platform Specific/Hardware
           Version: 2.5
    Kernel Version: 2.6.30
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Alpha
        AssignedTo: rth at twiddle.net
        ReportedBy: ettl.martin at gmx.de
        Regression: No


Hello,

i have checked the source of the linux kernel with a static code analyis tool
(cppcheck). It found two resource leaks in file 
"linux-2.6.30/arch/alpha/boot/tools/objstrip.c".

cppcheck prints the following output:

[linux-2.6.30/arch/alpha/boot/tools/objstrip.c:134]: (error) Resource leak: fd
[linux-2.6.30/arch/alpha/boot/tools/objstrip.c:134]: (error) Resource leak: ofd


Take a look at file objstrip.c at line 134:


...
    printf("%lu\n", size);
    return 0;
...

Indeed fd and ofd are not closed.
A possible fix might be:
...
    printf("%lu\n", size);
        close(fd);
        close(ofd);
    return 0;
...


Best regards

Ettl Martin

-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the Bugme-new mailing list