From: Li Xi Subject: A memory-leak problem of unix_open() Date: Mon, 17 Dec 2012 00:34:56 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=bcaec517cda854815404d0fad8b2 To: linux-ext4@vger.kernel.org Return-path: Received: from mail-ie0-f174.google.com ([209.85.223.174]:54578 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750845Ab2LPQe5 (ORCPT ); Sun, 16 Dec 2012 11:34:57 -0500 Received: by mail-ie0-f174.google.com with SMTP id c11so8192723ieb.19 for ; Sun, 16 Dec 2012 08:34:56 -0800 (PST) Sender: linux-ext4-owner@vger.kernel.org List-ID: --bcaec517cda854815404d0fad8b2 Content-Type: text/plain; charset=ISO-8859-1 Hi all, I think I found a memory-leak problem of e2fsprofgs while using valgrind to testing a tool. 'log.txt' is the output. It is a simple problem. I wrote a patch, and it works on my server. Thanks Li Xi --bcaec517cda854815404d0fad8b2 Content-Type: text/plain; charset=US-ASCII; name="log.txt" Content-Disposition: attachment; filename="log.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_haseailo1 W3Jvb3RAbWRzMDEgbW1wXSMgdmFsZ3JpbmQgLS1sZWFrLWNoZWNrPWZ1bGwgLi9tbXBzdGF0dXMg L2Rldi9zZCANCj09MTk3OTA9PSBNZW1jaGVjaywgYSBtZW1vcnkgZXJyb3IgZGV0ZWN0b3IuDQo9 PTE5NzkwPT0gQ29weXJpZ2h0IChDKSAyMDAyLTIwMDYsIGFuZCBHTlUgR1BMJ2QsIGJ5IEp1bGlh biBTZXdhcmQgZXQgYWwuDQo9PTE5NzkwPT0gVXNpbmcgTGliVkVYIHJldiAxNjU4LCBhIGxpYnJh cnkgZm9yIGR5bmFtaWMgYmluYXJ5IHRyYW5zbGF0aW9uLg0KPT0xOTc5MD09IENvcHlyaWdodCAo QykgMjAwNC0yMDA2LCBhbmQgR05VIEdQTCdkLCBieSBPcGVuV29ya3MgTExQLg0KPT0xOTc5MD09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gYnkg MHg0QzQ5OEZDOiB1bml4X29wZW4gKGV4dDJmcy5oOjE1MDIpDQo9PTE5NzkwPT0gICAgYnkgMHg0 QzNGMzBCOiBleHQyZnNfb3BlbjIgKG9wZW5mcy5jOjEzOSkNCj09MTk3OTA9PSAgICBieSAweDRD M0ZBMTg6IGV4dDJmc19vcGVuIChvcGVuZnMuYzo3NSkNCj09MTk3OTA9PSAgICBieSAweDQwMTE2 QzogbWFpbiAoaW4gL2hvbWUvbGl4aS9tbXAvbW1wc3RhdHVzKQ0KPT0xOTc5MD09IA0KPT0xOTc5 MD09IExFQUsgU1VNTUFSWToNCj09MTk3OTA9PSAgICBkZWZpbml0ZWx5IGxvc3Q6IDggYnl0ZXMg aW4gMSBibG9ja3MuDQo9PTE5NzkwPT0gICAgICBwb3NzaWJseSBsb3N0OiAwIGJ5dGVzIGluIDAg YmxvY2tzLg0KPT0xOTc5MD09ICAgIHN0aWxsIHJlYWNoYWJsZTogMCBieXRlcyBpbiAwIGJsb2Nr cy4NCj09MTk3OTA9PSAgICAgICAgIHN1cHByZXNzZWQ6IDAgYnl0ZXMgaW4gMCBibG9ja3MuDQo9 PTE5NzkwPT0gUmVhY2hhYmxlIGJsb2NrcyAodGhvc2UgdG8gd2hpY2ggYSBwb2ludGVyIHdhcyBm b3VuZCkgYXJlIG5vdCBzaG93bi4NCj09MTk3OTA9PSBUbyBzZWUgdGhlbSwgcmVydW4gd2l0aDog LS1zaG93LXJlYWNoYWJsZT15ZXM= --bcaec517cda854815404d0fad8b2 Content-Type: application/octet-stream; name="bug_unix_open_memleak_e2fsprogs-1.42.6.patch" Content-Disposition: attachment; filename="bug_unix_open_memleak_e2fsprogs-1.42.6.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_haseafza0 SW5kZXg6IGUyZnNwcm9ncy0xLjQyLjYvbGliL2V4dDJmcy91bml4X2lvLmMKPT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQot LS0gZTJmc3Byb2dzLTEuNDIuNi5vcmlnL2xpYi9leHQyZnMvdW5peF9pby5jCTIwMTItMTItMTcg MDY6NDY6MzAuMDAwMDAwMDAwICswODAwCisrKyBlMmZzcHJvZ3MtMS40Mi42L2xpYi9leHQyZnMv dW5peF9pby5jCTIwMTItMTItMTcgMDc6MTE6MDAuMDAwMDAwMDAwICswODAwCkBAIC02MjQsOCAr NjI0LDEyIEBACiAJCWZyZWVfY2FjaGUoZGF0YSk7CiAJCWV4dDJmc19mcmVlX21lbSgmZGF0YSk7 CiAJfQotCWlmIChpbykKKwlpZiAoaW8pIHsKKwkJaWYgKGlvLT5uYW1lKSB7CisJCQlleHQyZnNf ZnJlZV9tZW0oJmlvLT5uYW1lKTsKKwkJfQogCQlleHQyZnNfZnJlZV9tZW0oJmlvKTsKKwl9CiAJ cmV0dXJuIHJldHZhbDsKIH0KIAo= --bcaec517cda854815404d0fad8b2--