qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] migration: using qapi_free_SocketAddress instead of g_free
@ 2023-12-06 10:01 lijiejun
  2023-12-06 10:57 ` Daniel P. Berrangé
  0 siblings, 1 reply; 2+ messages in thread
From: lijiejun @ 2023-12-06 10:01 UTC (permalink / raw)
  To: quintela, peterx, farosas; +Cc: qemu-devel, lijiejun

use unified function qapi_free_SocketAddress to free SocketAddress
object.

Signed-off-by: lijiejun <a_lijiejun@163.com>
---
 migration/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/migration.c b/migration/migration.c
index 3ce04b2aaf..e78d31bbbf 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -493,7 +493,7 @@ bool migrate_uri_parse(const char *uri, MigrationChannel **channel,
         addr->u.socket.type = saddr->type;
         addr->u.socket.u = saddr->u;
         /* Don't free the objects inside; their ownership moved to "addr" */
-        g_free(saddr);
+        qapi_free_SocketAddress(saddr);
     } else if (strstart(uri, "file:", NULL)) {
         addr->transport = MIGRATION_ADDRESS_TYPE_FILE;
         addr->u.file.filename = g_strdup(uri + strlen("file:"));
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] migration: using qapi_free_SocketAddress instead of g_free
  2023-12-06 10:01 [PATCH] migration: using qapi_free_SocketAddress instead of g_free lijiejun
@ 2023-12-06 10:57 ` Daniel P. Berrangé
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2023-12-06 10:57 UTC (permalink / raw)
  To: lijiejun; +Cc: quintela, peterx, farosas, qemu-devel

On Wed, Dec 06, 2023 at 06:01:11PM +0800, lijiejun wrote:
> use unified function qapi_free_SocketAddress to free SocketAddress
> object.
> 
> Signed-off-by: lijiejun <a_lijiejun@163.com>
> ---
>  migration/migration.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 3ce04b2aaf..e78d31bbbf 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -493,7 +493,7 @@ bool migrate_uri_parse(const char *uri, MigrationChannel **channel,
>          addr->u.socket.type = saddr->type;
>          addr->u.socket.u = saddr->u;
>          /* Don't free the objects inside; their ownership moved to "addr" */
> -        g_free(saddr);
> +        qapi_free_SocketAddress(saddr);

The comment on the line above that explains we only want to free
'saddr', not its contents.

>      } else if (strstart(uri, "file:", NULL)) {
>          addr->transport = MIGRATION_ADDRESS_TYPE_FILE;
>          addr->u.file.filename = g_strdup(uri + strlen("file:"));
> -- 
> 2.25.1
> 
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-06 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-06 10:01 [PATCH] migration: using qapi_free_SocketAddress instead of g_free lijiejun
2023-12-06 10:57 ` Daniel P. Berrangé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).