lkml.org 
[lkml]   [2003]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [CHECKER] 32 Memory Leaks on Error Paths
    * David Yu Chen (dychen@stanford.edu) wrote:
    > [FILE: 2.6.0-test5/security/selinux/ss/policydb.c]
    > START -->
    > 1232: c = kmalloc(sizeof(*c), GFP_KERNEL);
    > 1233: if (!c) {
    > 1234: rc = -ENOMEM;
    > 1235: goto bad;
    > 1236: }
    > 1237: memset(c, 0, sizeof(*c));
    > ... DELETED 182 lines ...

    You missed a reference to the context is stored in the policydb:
    p->ocontexts[i] = c;
    > END -->
    > 1427: return rc;
    > 1428:bad:
    > 1429: policydb_destroy(p);

    The policydb is destroyed on error, which will free the context. I
    don't think this is a bug.

    thanks,
    -chris
    --
    Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:48    [W:0.020 / U:1.100 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site