diff mbox

[RESEND] ceph: Fix memory leak in chain_listxattr

Message ID 1383122349-18950-1-git-send-email-liwang@ubuntukylin.com (mailing list archive)
State New, archived
Headers show

Commit Message

Li Wang Oct. 30, 2013, 8:39 a.m. UTC
Free allocated memory before return

Signed-off-by: Li Wang <liwang@ubuntukylin.com>
---
 src/os/chain_xattr.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sage Weil Oct. 30, 2013, 4:03 p.m. UTC | #1
Hi Li,

Applied both of these.  THanks!

sage

On Wed, 30 Oct 2013, Li Wang wrote:

> Free allocated memory before return
> 
> Signed-off-by: Li Wang <liwang@ubuntukylin.com>
> ---
>  src/os/chain_xattr.cc |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/os/chain_xattr.cc b/src/os/chain_xattr.cc
> index 62733e3..52ae8db 100644
> --- a/src/os/chain_xattr.cc
> +++ b/src/os/chain_xattr.cc
> @@ -355,7 +355,7 @@ int chain_listxattr(const char *fn, char *names, size_t len) {
>  
>    r = sys_listxattr(fn, full_buf, total_len);
>    if (r < 0)
> -    return r;
> +    goto done;
>  
>    char *p = full_buf;
>    const char *end = full_buf + r;
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/os/chain_xattr.cc b/src/os/chain_xattr.cc
index 62733e3..52ae8db 100644
--- a/src/os/chain_xattr.cc
+++ b/src/os/chain_xattr.cc
@@ -355,7 +355,7 @@  int chain_listxattr(const char *fn, char *names, size_t len) {
 
   r = sys_listxattr(fn, full_buf, total_len);
   if (r < 0)
-    return r;
+    goto done;
 
   char *p = full_buf;
   const char *end = full_buf + r;