[Stgt-devel] vtl patch.
Ming Zhang
blackmagic02881
Thu Apr 5 03:22:57 CEST 2007
On Thu, 2007-04-05 at 09:56 +1000, Mark Harvey wrote:
> +smc_init(struct scsi_lu *lu) {
> + struct smc_info * smc;
> +
> + dprintf("Medium Changer init() called");
> + smc = zalloc(sizeof(struct smc_info));
> + if(! smc)
> + return -ENOMEM;
> + smc->phy = zalloc(sizeof(struct physicalAttributes));
> + if(! smc->phy)
> + return -ENOMEM;
> + smc->log = zalloc(sizeof(struct smcLogPage));
> + if(! smc->log)
> + return -ENOMEM;
> + lu->priv_p = smc;
> + return 0;
> +}
> +
potential memory leak on error path here? for example, if smc->log is
NULL, smc and smc-?phy should be freed.
More information about the stgt
mailing list