Bug 11425 - [linux-2.6/drivers/char/tpm/tpm.c:1208]: Memory leak: devname
[linux-2.6/drivers/char/tpm/tpm.c:1208]: Memory leak: devname
Status: CLOSED CODE_FIX
Product: Drivers
Classification: Unclassified
Component: Other
All Linux
: P1 normal
Assigned To: Randy Dunlap
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-25 10:56 UTC by Daniel Marjamäki
Modified: 2012-05-22 13:34 UTC (History)
2 users (show)

See Also:
Kernel Version: latest git tree
Tree: Mainline
Regression: No


Attachments
Relesae memory on init failure. (1.71 KB, patch)
2008-09-08 10:43 UTC, Randy Dunlap
Details | Diff

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.

Note You need to log in before you can comment on or make changes to this bug.