diff mbox

[07/37] tests: fix test-iov leaks

Message ID 20160719085432.4572-8-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau July 19, 2016, 8:54 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Spotted thanks to ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/test-iov.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Eric Blake July 19, 2016, 8:46 p.m. UTC | #1
On 07/19/2016 02:54 AM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Spotted thanks to ASAN.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/test-iov.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tests/test-iov.c b/tests/test-iov.c
> index 46ae25e..a22d71f 100644
> --- a/tests/test-iov.c
> +++ b/tests/test-iov.c
> @@ -208,6 +208,9 @@ static void test_io(void)
>                 } while(k < j);
>             }
>         }
> +       iov_free(iov, niov);
> +       g_free(buf);
> +       g_free(siov);
>         exit(0);

Calling exit() implicitly frees things, but I'm not opposed to the patch.

Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox

Patch

diff --git a/tests/test-iov.c b/tests/test-iov.c
index 46ae25e..a22d71f 100644
--- a/tests/test-iov.c
+++ b/tests/test-iov.c
@@ -208,6 +208,9 @@  static void test_io(void)
                } while(k < j);
            }
        }
+       iov_free(iov, niov);
+       g_free(buf);
+       g_free(siov);
        exit(0);
 
     } else {
@@ -246,6 +249,10 @@  static void test_io(void)
                test_iov_bytes(iov, niov, i, j - i);
            }
         }
+
+       iov_free(iov, niov);
+       g_free(buf);
+       g_free(siov);
      }
 #endif
 }