Bug 11425

Summary: [linux-2.6/drivers/char/tpm/tpm.c:1208]: Memory leak: devname
Product: Drivers Reporter: Daniel Marjamäki (danielm77)
Component: OtherAssignee: Randy Dunlap (randy.dunlap)
Status: CLOSED CODE_FIX    
Severity: normal CC: alan, randy.dunlap
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: latest git tree Subsystem:
Regression: No Bisected commit-id:
Attachments: Relesae memory on init failure.

Description Daniel Marjamäki 2008-08-25 10:56:07 UTC
In the function tpm_register_hardware there is this condition...

	if (chip->dev_num >= TPM_NUM_DEVICES) {
		dev_err(dev, "No available tpm device numbers\n");
		kfree(chip);
		return NULL;
	}

Before the return, devname should be kfree'd
Comment 1 Randy Dunlap 2008-09-03 19:24:28 UTC
Shouldn't all of the "return NULL" locations also free chip and devname?
Comment 2 Randy Dunlap 2008-09-08 10:43:14 UTC
Created attachment 17680 [details]
Relesae memory on init failure.