All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bs_sheepdog.c: fix memory leak issues in sd_open()
@ 2013-10-31  8:36 Ryusuke Konishi
  2013-10-31  8:48 ` [sheepdog] " Hitoshi Mitake
  2013-11-01  0:46 ` FUJITA Tomonori
  0 siblings, 2 replies; 3+ messages in thread
From: Ryusuke Konishi @ 2013-10-31  8:36 UTC (permalink / raw)
  To: Hitoshi Mitake; +Cc: stgt, sheepdog, Ryusuke Konishi

This fixes memory leak issues in sd_open function which were brought
by the patch titled "bs_sheepdog.c: support various VDI options in
--backing-store option" (commit:
f282f83c036e298f316ef64d1e51aff3f57b9eaf).

The current sd_open function doesn't free locally allocated string
"orig_filename" nor restores "filename" argument temporarily broken
for parsing VDI options when unknown protocol was specified or tcp
port number was malformed.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
---
 usr/bs_sheepdog.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/usr/bs_sheepdog.c b/usr/bs_sheepdog.c
index 8bb5c80..7341708 100644
--- a/usr/bs_sheepdog.c
+++ b/usr/bs_sheepdog.c
@@ -962,7 +962,8 @@ static int sd_open(struct sheepdog_access_info *ai, char *filename, int flags)
 			} else {
 				eprintf("unknown protocol of sheepdog vdi:"\
 					" %s\n", result);
-				return -1;
+				ret = -1;
+				goto out;
 			}
 			break;
 		case EXPECT_PATH:
@@ -979,7 +980,8 @@ static int sd_open(struct sheepdog_access_info *ai, char *filename, int flags)
 				if (!isdigit(result[i])) {
 					eprintf("invalid tcp port number:"\
 						" %s\n", result);
-					return -1;
+					ret = -1;
+					goto out;
 				}
 			}
 
-- 
1.7.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [sheepdog] [PATCH] bs_sheepdog.c: fix memory leak issues in sd_open()
  2013-10-31  8:36 [PATCH] bs_sheepdog.c: fix memory leak issues in sd_open() Ryusuke Konishi
@ 2013-10-31  8:48 ` Hitoshi Mitake
  2013-11-01  0:46 ` FUJITA Tomonori
  1 sibling, 0 replies; 3+ messages in thread
From: Hitoshi Mitake @ 2013-10-31  8:48 UTC (permalink / raw)
  To: Ryusuke Konishi; +Cc: Hitoshi Mitake, sheepdog, stgt

At Thu, 31 Oct 2013 17:36:34 +0900,
Ryusuke Konishi wrote:
> 
> This fixes memory leak issues in sd_open function which were brought
> by the patch titled "bs_sheepdog.c: support various VDI options in
> --backing-store option" (commit:
> f282f83c036e298f316ef64d1e51aff3f57b9eaf).
> 
> The current sd_open function doesn't free locally allocated string
> "orig_filename" nor restores "filename" argument temporarily broken
> for parsing VDI options when unknown protocol was specified or tcp
> port number was malformed.
> 
> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
> ---
>  usr/bs_sheepdog.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Looks good to me. Thanks for catching.
Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>

> 
> diff --git a/usr/bs_sheepdog.c b/usr/bs_sheepdog.c
> index 8bb5c80..7341708 100644
> --- a/usr/bs_sheepdog.c
> +++ b/usr/bs_sheepdog.c
> @@ -962,7 +962,8 @@ static int sd_open(struct sheepdog_access_info *ai, char *filename, int flags)
>  			} else {
>  				eprintf("unknown protocol of sheepdog vdi:"\
>  					" %s\n", result);
> -				return -1;
> +				ret = -1;
> +				goto out;
>  			}
>  			break;
>  		case EXPECT_PATH:
> @@ -979,7 +980,8 @@ static int sd_open(struct sheepdog_access_info *ai, char *filename, int flags)
>  				if (!isdigit(result[i])) {
>  					eprintf("invalid tcp port number:"\
>  						" %s\n", result);
> -					return -1;
> +					ret = -1;
> +					goto out;
>  				}
>  			}
>  
> -- 
> 1.7.9.3
> 
> -- 
> sheepdog mailing list
> sheepdog@lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bs_sheepdog.c: fix memory leak issues in sd_open()
  2013-10-31  8:36 [PATCH] bs_sheepdog.c: fix memory leak issues in sd_open() Ryusuke Konishi
  2013-10-31  8:48 ` [sheepdog] " Hitoshi Mitake
@ 2013-11-01  0:46 ` FUJITA Tomonori
  1 sibling, 0 replies; 3+ messages in thread
From: FUJITA Tomonori @ 2013-11-01  0:46 UTC (permalink / raw)
  To: konishi.ryusuke; +Cc: mitake.hitoshi, stgt, sheepdog

On Thu, 31 Oct 2013 17:36:34 +0900
Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> wrote:

> This fixes memory leak issues in sd_open function which were brought
> by the patch titled "bs_sheepdog.c: support various VDI options in
> --backing-store option" (commit:
> f282f83c036e298f316ef64d1e51aff3f57b9eaf).
> 
> The current sd_open function doesn't free locally allocated string
> "orig_filename" nor restores "filename" argument temporarily broken
> for parsing VDI options when unknown protocol was specified or tcp
> port number was malformed.
> 
> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
> ---
>  usr/bs_sheepdog.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-01  0:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-31  8:36 [PATCH] bs_sheepdog.c: fix memory leak issues in sd_open() Ryusuke Konishi
2013-10-31  8:48 ` [sheepdog] " Hitoshi Mitake
2013-11-01  0:46 ` FUJITA Tomonori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.