public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Wei, Jiangang" <weijg.fnst@cn.fujitsu.com>
To: "standby24x7@gmail.com" <standby24x7@gmail.com>
Cc: "r.baldyga@samsung.com" <r.baldyga@samsung.com>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"balbi@ti.com" <balbi@ti.com>,
	"jkosina@suse.cz" <jkosina@suse.cz>
Subject: Re: [PATCH] tools: ffs-aio-example: free memory upon failure
Date: Wed, 18 Nov 2015 06:13:34 +0000	[thread overview]
Message-ID: <1447827215.8767.3.camel@localhost> (raw)
In-Reply-To: <1447049776-23413-1-git-send-email-weijg.fnst@cn.fujitsu.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2715 bytes --]

To whom it may concern:

Sorry to bother again,
But any comment about this patch?

Regards,
wei
On Mon, 2015-11-09 at 14:16 +0800, Wei Jiangang wrote:
> Free buffer to avoid memory leak upon failure occurs.
> 
> Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
> ---
>  tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c | 4 ++++
>  tools/usb/ffs-aio-example/simple/device_app/aio_simple.c       | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c b/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c
> index aaca1f44e788..3eb1a92baacf 100644
> --- a/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c
> +++ b/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c
> @@ -263,20 +263,24 @@ int main(int argc, char *argv[])
>  	sprintf(ep_path, "%s/ep0", argv[1]);
>  	ep0 = open(ep_path, O_RDWR);
>  	if (ep0 < 0) {
> +		free(ep_path);
>  		perror("unable to open ep0");
>  		return 1;
>  	}
>  	if (write(ep0, &descriptors, sizeof(descriptors)) < 0) {
> +		free(ep_path);
>  		perror("unable do write descriptors");
>  		return 1;
>  	}
>  	if (write(ep0, &strings, sizeof(strings)) < 0) {
> +		free(ep_path);
>  		perror("unable to write strings");
>  		return 1;
>  	}
>  	sprintf(ep_path, "%s/ep1", argv[1]);
>  	ep1 = open(ep_path, O_RDWR);
>  	if (ep1 < 0) {
> +		free(ep_path);
>  		perror("unable to open ep1");
>  		return 1;
>  	}
> diff --git a/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c b/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c
> index 1f44a29818bf..ac96892ca5d2 100644
> --- a/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c
> +++ b/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c
> @@ -234,14 +234,17 @@ int main(int argc, char *argv[])
>  	sprintf(ep_path, "%s/ep0", argv[1]);
>  	ep0 = open(ep_path, O_RDWR);
>  	if (ep0 < 0) {
> +		free(ep_path);
>  		perror("unable to open ep0");
>  		return 1;
>  	}
>  	if (write(ep0, &descriptors, sizeof(descriptors)) < 0) {
> +		free(ep_path);
>  		perror("unable do write descriptors");
>  		return 1;
>  	}
>  	if (write(ep0, &strings, sizeof(strings)) < 0) {
> +		free(ep_path);
>  		perror("unable to write strings");
>  		return 1;
>  	}
> @@ -249,6 +252,7 @@ int main(int argc, char *argv[])
>  		sprintf(ep_path, "%s/ep%d", argv[1], i+1);
>  		ep[i] = open(ep_path, O_RDWR);
>  		if (ep[i] < 0) {
> +			free(ep_path);
>  			printf("unable to open ep%d: %s\n", i+1,
>  			       strerror(errno));
>  			return 1;

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  reply	other threads:[~2015-11-18  6:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09  6:16 [PATCH] tools: ffs-aio-example: free memory upon failure Wei Jiangang
2015-11-18  6:13 ` Wei, Jiangang [this message]
2015-11-18  9:46   ` Robert Baldyga
2015-11-19  9:26     ` [PATCH v2] tools: ffs-aio-example: clean up " Wei Jiangang
2015-11-19  9:30     ` [PATCH] tools: ffs-aio-example: free memory " Wei, Jiangang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447827215.8767.3.camel@localhost \
    --to=weijg.fnst@cn.fujitsu.com \
    --cc=balbi@ti.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=r.baldyga@samsung.com \
    --cc=rdunlap@infradead.org \
    --cc=standby24x7@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox