Changeset 660f70f4c4c169214da8ac670fbecfb37ce3d2d5

Show
Ignore:
Timestamp:
03/06/10 16:56:24 (5 months ago)
Author:
Joshua Brindle <method@manicmethod.com>
Committer:
Joshua Brindle <method@manicmethod.com> 1267916184 -0500
Parent:

[c8d100bb03e0fe0501037b914fe3638afd593ee4]

Message:

Author: Daniel J Walsh
Email: dwalsh@redhat.com
Subject: Fix memory leak on disabled selinux machines.
Date: Wed, 24 Feb 2010 14:15:31 -0500

I think this patch originally came from Eric Paris and was updated by
others but has not been adopted yet. Not sure why.

Always free buf on exit.

Signed-off-by: Joshua Brindle <method@manicmethod.com>

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libselinux/src/init.c

    r8c372f6 r660f70f  
    2424{ 
    2525        char *buf=NULL, *p; 
    26         FILE *fp
     26        FILE *fp=NULL
    2727        struct statfs sfbuf; 
    2828        int rc; 
     
    5858                } 
    5959        } 
     60 
     61        if (!exists)  
     62                goto out; 
     63 
    6064        fclose(fp); 
    61  
    62         if (!exists) 
    63                 return; 
    6465 
    6566        /* At this point, the usual spot doesn't have an selinuxfs so 
     
    6768        fp = fopen("/proc/mounts", "r"); 
    6869        if (!fp) 
    69                 return
     70                goto out
    7071 
    7172        __fsetlocking(fp, FSETLOCKING_BYCALLER); 
     
    9192      out: 
    9293        free(buf); 
    93         fclose(fp); 
     94        if (fp) 
     95                fclose(fp); 
    9496        return; 
    9597}