Changeset 17702


Ignore:
Timestamp:
09/28/11 17:46:43 (21 months ago)
Author:
chris
Message:

mac80211 fix memleak

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/libutils/mac80211regulatory.c

    r15973 r17702  
    169169        if (db == MAP_FAILED) { 
    170170                perror("failed to mmap db file"); 
     171                if (fd) close(fd); 
    171172                return rd; 
    172173        } 
     
    177178        if (ntohl(header->magic) != REGDB_MAGIC) { 
    178179                fprintf(stderr, "Invalid database magic\n"); 
    179                 return rd; 
     180                goto out; 
    180181        } 
    181182 
    182183        if (ntohl(header->version) != REGDB_VERSION) { 
    183184                fprintf(stderr, "Invalid database version\n"); 
    184                 return rd; 
     185                goto out; 
    185186        } 
    186187 
     
    191192        if (dblen <= (int)sizeof(*header)) { 
    192193                fprintf(stderr, "Invalid signature length %d\n", siglen); 
    193                 return rd; 
     194                goto out; 
    194195        } 
    195196 
     
    209210        if (!found_country) { 
    210211                fprintf(stderr, "No country match in regulatory database.\n"); 
    211                 return rd; 
     212                goto out; 
    212213        } 
    213214        rd = country2rd(db, dblen, country); 
     215out: 
     216        if (munmap(db, dblen+siglen) == -1) { 
     217                fprintf(stderr, "mac80211regulatory failed to munmap crda database\n"); 
     218                } 
     219        if (fd) close(fd); 
    214220        return rd; 
    215221} 
Note: See TracChangeset for help on using the changeset viewer.