We can steal the strings instead of creating more copies. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/vbox/vbox_common.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 8f5f04efb..1a413e4ac 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -3719,9 +3719,7 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter) gVBoxAPI.UINetworkAdapter.GetBridgedInterface(adapter, &utf16); VBOX_UTF16_TO_UTF8(utf16, &utf8); - ignore_value(VIR_STRDUP(net->data.bridge.brname, utf8)); - - VBOX_UTF8_FREE(utf8); + VIR_STEAL_PTR(net->data.bridge.brname, utf8); VBOX_UTF16_FREE(utf16); break; @@ -3731,9 +3729,7 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter) gVBoxAPI.UINetworkAdapter.GetInternalNetwork(adapter, &utf16); VBOX_UTF16_TO_UTF8(utf16, &utf8); - ignore_value(VIR_STRDUP(net->data.internal.name, utf8)); - - VBOX_UTF8_FREE(utf8); + VIR_STEAL_PTR(net->data.internal.name, utf8); VBOX_UTF16_FREE(utf16); break; @@ -3743,9 +3739,7 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter) gVBoxAPI.UINetworkAdapter.GetHostOnlyInterface(adapter, &utf16); VBOX_UTF16_TO_UTF8(utf16, &utf8); - ignore_value(VIR_STRDUP(net->data.network.name, utf8)); - - VBOX_UTF8_FREE(utf8); + VIR_STEAL_PTR(net->data.network.name, utf8); VBOX_UTF16_FREE(utf16); break; -- 2.13.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list