Skip to contentSkip to conversation

block/nbd: Fix the regression to free leaked visitor

PATCH Superseded Ashijeet Acharya 2 participants 3 messages Nov 2, 2016 Block layer

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 block/nbd: Fix the regression to free leaked visitor

This patch frees the leaked visitor in nbd_refresh_filename() and uses visit_free() to fix it. The leak was introduced by the commit 491d6c7.

---
Changes in v2:
- Include the regression commit id in the commit message

---
 block/nbd.c | 1 +
 1 file changed, 1 insertion(+)
block/nbd.c +1 -0
index 8ef1438..ff9d01a 100644
@@ -545,6 +545,7 @@ static void nbd_refresh_filename(BlockDriverState *bs, QDict *options)
         qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid));
     }
 
+    visit_free(ov);
     qdict_flatten(opts);
     bs->full_open_options = opts;
 }
Signature · 1 line
2.6.2
#1 lore raw

Am 02.11.2016 um 10:48 hat Ashijeet Acharya geschrieben:

Quoted 5 lines

This patch frees the leaked visitor in nbd_refresh_filename() and uses visit_free() to fix it. The leak was introduced by the commit 491d6c7.

I don't think this would generally be called a regression, so I'd change the subject to just "nbd: Fix leaker visitor".

Quoted 11 lines

Changes in v2:
- Include the regression commit id in the commit message

---
 block/nbd.c | 1 +
 1 file changed, 1 insertion(+)
block/nbd.c +0 -0
index 8ef1438..ff9d01a 100644

block/nbd.c static void nbd_refresh_filename(BlockDriverState *bs, QDict *options) · line 551

Quoted 7 lines
block/nbd.c +1 -0
@@ -545,6 +545,7 @@ static void nbd_refresh_filename(BlockDriverState *bs, QDict *options)
         qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid));
     }
 
+    visit_free(ov);
     qdict_flatten(opts);
     bs->full_open_options = opts;
 }

I would prefer freeing the visitor immediately after visit_complete() so that everything visitor related is in a single place.

Both of these points don't make your patch wrong, of course, but would you mind changing them?

Kevin

#2 lore raw
Quoted 32 lines · Kevin Wolf

Am 02.11.2016 um 10:48 hat Ashijeet Acharya geschrieben:

Quoted 5 lines

This patch frees the leaked visitor in nbd_refresh_filename() and uses visit_free() to fix it. The leak was introduced by the commit 491d6c7.

I don't think this would generally be called a regression, so I'd change the subject to just "nbd: Fix leaker visitor".

Quoted 11 lines

Changes in v2:
- Include the regression commit id in the commit message

---
 block/nbd.c | 1 +
 1 file changed, 1 insertion(+)
block/nbd.c +0 -0
index 8ef1438..ff9d01a 100644

block/nbd.c static void nbd_refresh_filename(BlockDriverState *bs, QDict *options) · line 551

Quoted 7 lines
block/nbd.c +1 -0
@@ -545,6 +545,7 @@ static void nbd_refresh_filename(BlockDriverState *bs, QDict *options)
         qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid));
     }
 
+    visit_free(ov);
     qdict_flatten(opts);
     bs->full_open_options = opts;
 }

I would prefer freeing the visitor immediately after visit_complete() so that everything visitor related is in a single place.

Quoted 2 lines

Both of these points don't make your patch wrong, of course, but would you mind changing them?

Sure, I will send v3 straight away.

Ashijeet

Quoted 1 line

Kevin