Changeset 85c4cc45 in mainline


Ignore:
Timestamp:
2011-11-14T11:01:46Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b93658
Parents:
a066c1b9
Message:

isa: One less malloc. Fix name memory leak.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/isa/isa.c

    ra066c1b9 r85c4cc45  
    8989        fibril_mutex_t mutex;
    9090        ddf_fun_t *fnode;
     91        hw_resource_t resources[ISA_MAX_HW_RES];
    9192        hw_resource_list_t hw_resources;
    9293        link_t bus_link;
     
    201202
    202203        fibril_mutex_initialize(&fun->mutex);
     204        fun->hw_resources.resources = fun->resources;
     205
    203206        fun->fnode = fnode;
    204207        return fun;
     
    510513}
    511514
    512 static void fun_hw_res_alloc(isa_fun_t *fun)
    513 {
    514         fun->hw_resources.resources =
    515             (hw_resource_t *)malloc(sizeof(hw_resource_t) * ISA_MAX_HW_RES);
    516 }
    517 
    518 static void fun_hw_res_free(isa_fun_t *fun)
    519 {
    520         free(fun->hw_resources.resources);
    521         fun->hw_resources.resources = NULL;
    522 }
    523 
    524515static char *isa_fun_read_info(char *fun_conf, isa_bus_t *isa)
    525516{
     
    546537
    547538        isa_fun_t *fun = isa_fun_create(isa, fun_name);
     539        free(fun_name);
    548540        if (fun == NULL) {
    549                 free(fun_name);
    550541                return NULL;
    551542        }
    552 
    553         /* Allocate buffer for the list of hardware resources of the device. */
    554         fun_hw_res_alloc(fun);
    555543
    556544        /* Get properties of the device (match ids, irq and io range). */
     
    669657                list_remove(&fun->bus_link);
    670658
    671                 fun_hw_res_free(fun);
    672659                ddf_fun_destroy(fun->fnode);
    673660        }
Note: See TracChangeset for help on using the changeset viewer.