Re: [PATCH] transport: fix leak with transport helper URLs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 08, 2024 at 06:52:31AM +0200, Patrick Steinhardt wrote:
> On Wed, Aug 07, 2024 at 06:11:10PM -0700, Junio C Hamano wrote:
> > Transport URLs can be prefixed with "foo::", which would tell us that
> > the transport uses a remote helper called "foo". We extract the helper
> > name by `xstrndup()`ing the prefix before the double-colons, but never
> > free that string.
> > 
> > Fix this leak by assigning the result to a separate local variable that
> > we can then free upon returning.
> > 
> > Helped-by: Patrick Steinhardt <ps@xxxxxx>
> > Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
> 
> I saw that you've merged this to `next` already, but: this looks good to
> me, thanks!
> 
> Patrick

I just noticed that this also makes a couple of test suites pass with
leak checking enabled. So below diff should likely be applied on top.

Patrick

diff --git a/t/t5509-fetch-push-namespaces.sh b/t/t5509-fetch-push-namespaces.sh
index 31553b48df..05090feaf9 100755
--- a/t/t5509-fetch-push-namespaces.sh
+++ b/t/t5509-fetch-push-namespaces.sh
@@ -4,6 +4,7 @@ test_description='fetch/push involving ref namespaces'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh

 test_expect_success setup '
diff --git a/t/t5802-connect-helper.sh b/t/t5802-connect-helper.sh
index c6c2661878..dd3e6235cd 100755
--- a/t/t5802-connect-helper.sh
+++ b/t/t5802-connect-helper.sh
@@ -1,6 +1,8 @@
 #!/bin/sh

 test_description='ext::cmd remote "connect" helper'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh

 test_expect_success setup '
diff --git a/t/t5814-proto-disable-ext.sh b/t/t5814-proto-disable-ext.sh
index 9d6f7dfa2c..6fe1a98b2a 100755
--- a/t/t5814-proto-disable-ext.sh
+++ b/t/t5814-proto-disable-ext.sh
@@ -1,6 +1,8 @@
 #!/bin/sh

 test_description='test disabling of remote-helper paths in clone/fetch'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY/lib-proto-disable.sh"

diff --git a/t/t5815-submodule-protos.sh b/t/t5815-submodule-protos.sh
index 4d5956cc18..fe899ee82d 100755
--- a/t/t5815-submodule-protos.sh
+++ b/t/t5815-submodule-protos.sh
@@ -1,6 +1,8 @@
 #!/bin/sh

 test_description='test protocol filtering with submodules'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-proto-disable.sh

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux