Hi Thomas, On 8/15/07, Thomas Renninger <trenn@xxxxxxx> wrote: > +int pnp_port_alloc (struct pnp_resource_table *res) > +{ > + int ret = 0, i; > + if (res->allocated_ports == 0) { > + res->port_resource = kmalloc(sizeof(struct resource) > + * PNP_ALLOC_PORTS, > + GFP_KERNEL); No need to use kmalloc() here. It's enough that you make sure res->port_resource is NULL when res->allocated_ports is zero and krealloc() will do the right thing. On 8/15/07, Thomas Renninger <trenn@xxxxxxx> wrote: > + if (!res->port_resource) { > + ret = -ENOMEM; > + goto out; > + } > + } else { > + res->port_resource = krealloc(res->port_resource, > + (sizeof(struct resource) > + * res->allocated_ports) > + + > + (sizeof(struct resource) > + * PNP_ALLOC_PORTS), > + GFP_KERNEL); Assuming res->port_resource is non-NULL here and krealloc() fails, you've leaked the originally allocated memory. Pekka - To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html