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

Re: [PATCH] virnetserver: fix some memory leaks in virNetTLSContextReloadForServer



Hi Daniel,

I tried to apply this patch locally and there was no corruption. Now I regenerate it, please apply it again.

Thanks,

Yan


From 0f667550dbe2e79e8d3c5881b9102c15149546ee Mon Sep 17 00:00:00 2001
From: Jin Yan <jinyan12 huawei com>
Date: Fri, 7 Aug 2020 15:59:45 +0800
Subject: [PATCH] virnetserver: fix some memory leaks in
 virNetTLSContextReloadForServer

These leaks were introduced in commit 15d280fa97b0, use g_autofree for all
cert_path pointers.

Signed-off-by: Jin Yan <jinyan12 huawei com>
---
 src/rpc/virnettlscontext.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index 168f3010ae..37564db14e 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -921,10 +921,10 @@ int virNetTLSContextReloadForServer(virNetTLSContextPtr ctxt,
 {
     gnutls_certificate_credentials_t x509credBak;
     int err;
-    char *cacert = NULL;
-    char *cacrl = NULL;
-    char *cert = NULL;
-    char *key = NULL;
+    g_autofree char *cacert = NULL;
+    g_autofree char *cacrl = NULL;
+    g_autofree char *cert = NULL;
+    g_autofree char *key = NULL;

     x509credBak = ctxt->x509cred;
     ctxt->x509cred = NULL;
--
2.23.0

On 2020/8/7 22:21, Daniel Henrique Barboza wrote:
The code looks right but I can't get the patch to be applied:

$ git am \[PATCH\]\ virnetserver\:\ fix\ some\ memory\ leaks\ in\ virNetTLSContextReloadForServer.eml warning: Patch sent with format=flowed; space at the end of lines might be lost. Applying: virnetserver: fix some memory leaks in virNetTLSContextReloadForServer
error: corrupt patch at line 10
Patch failed at 0001 virnetserver: fix some memory leaks in virNetTLSContextReloadForServer
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Can you re-send it?


Thanks,


DHB

On 8/7/20 5:49 AM, Jin Yan wrote:
 From 55fce33e9cf2d5ea58ebc44b4d78f9c12122fdcb Mon Sep 17 00:00:00 2001
From: Jin Yan <jinyan12 huawei com>
Date: Fri, 7 Aug 2020 15:59:45 +0800
Subject: [PATCH] virnetserver: fix some memory leaks in
  virNetTLSContextReloadForServer

These leaks were introduced in commit 15d280fa97b0, use g_autofree for all
cert_path pointers.

Signed-off-by: Jin Yan <jinyan12 huawei com>
---
  src/rpc/virnettlscontext.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index 168f3010ae..37564db14e 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -921,10 +921,10 @@ int virNetTLSContextReloadForServer(virNetTLSContextPtr ctxt,
  {
      gnutls_certificate_credentials_t x509credBak;
      int err;
-    char *cacert = NULL;
-    char *cacrl = NULL;
-    char *cert = NULL;
-    char *key = NULL;
+    g_autofree char *cacert = NULL;
+    g_autofree char *cacrl = NULL;
+    g_autofree char *cert = NULL;
+    g_autofree char *key = NULL;

      x509credBak = ctxt->x509cred;
      ctxt->x509cred = NULL;
--
2.23.0




.



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