chardev/tcp: fix error message double free error
PATCH v2 1/1 chardev/tcp: fix error message double free error
--- chardev/char-socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
chardev/char-socket.c +2 -1
@@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,"Unable to connect character device %s: " , chr->label); s->connect_err_reported = true; + }else { +error_free (err); }qemu_chr_socket_restart_timer (chr); }
@@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)if (qio_task_propagate_error (task, &err)) {tcp_chr_change_state (s,TCP_CHARDEV_STATE_DISCONNECTED );check_report_connect_error (chr, err); -error_free (err); goto cleanup; }
Signature · 1 line
2.18.4
Quoted 19 lines · lichun
Signed-off-by lichun <[email protected]>--- chardev/char-socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)chardev/char-socket.c +2
-0@@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,"Unable to connect character device %s: " , chr->label); s->connect_err_reported = true; + }else { +error_free (err); }qemu_chr_socket_restart_timer (chr); }
chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1092
Quoted 6 lines
chardev/char-socket.c +0
-1@@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)if (qio_task_propagate_error (task, &err)) {tcp_chr_change_state (s,TCP_CHARDEV_STATE_DISCONNECTED );check_report_connect_error (chr, err); -error_free (err); goto cleanup; }
Since my "Error handling fixes & cleanups" series fixes similar errors. I'm happy to merge this patch along with it. Up to Marc-André.
Hi
Quoted 23 lines · Markus Armbruster
Quoted 20 lines · lichun
Signed-off-by lichun <[email protected]>--- chardev/char-socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)chardev/char-socket.c +2
-0@@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,"Unable to connect character device %s: " , chr->label); s->connect_err_reported = true; + }else { +error_free (err); }qemu_chr_socket_restart_timer (chr); }@@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)if (qio_task_propagate_error (task, &err)) {
Quoted 8 lines
chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1092
Quoted 5 lines
chardev/char-socket.c +0
-1tcp_chr_change_state (s,TCP_CHARDEV_STATE_DISCONNECTED );check_report_connect_error (chr, err); -error_free (err); goto cleanup; }Since my "Error handling fixes & cleanups" series fixes similar errors. I'm happy to merge this patch along with it. Up to Marc-André.
That would be great, thanks!
Quoted 35 lines
Hi
Quoted 23 lines · Markus Armbruster
Quoted 20 lines · lichun
Signed-off-by lichun <[email protected]>---
chardev/char-socket.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)chardev/char-socket.c +2
-0@@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr, "Unable to connect character device %s: ", chr->label); s->connect_err_reported = true; + } else { + error_free(err); } qemu_chr_socket_restart_timer(chr); }@@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque) if (qio_task_propagate_error(task, &err)) {Quoted 8 lines
chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1092
Quoted 5 lines
chardev/char-socket.c +0
-1tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED); check_report_connect_error(chr, err); - error_free(err); goto cleanup; }Since my "Error handling fixes & cleanups" series fixes similar errors. I'm happy to merge this patch along with it. Up to Marc-André.
Quoted 1 line
That would be great, thanks!
Thank you!
Quoted 1 line
Quoted 19 lines · lichun
Signed-off-by lichun <[email protected]>--- chardev/char-socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)chardev/char-socket.c +2
-0@@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,"Unable to connect character device %s: " , chr->label); s->connect_err_reported = true; + }else { +error_free (err); }qemu_chr_socket_restart_timer (chr); }
chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1092
Quoted 6 lines
chardev/char-socket.c +0
-1@@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)if (qio_task_propagate_error (task, &err)) {tcp_chr_change_state (s,TCP_CHARDEV_STATE_DISCONNECTED );check_report_connect_error (chr, err); -error_free (err); goto cleanup; }
and queued, thanks!
Quoted 30 lines · Markus Armbruster
Quoted 19 lines · lichun
Signed-off-by lichun <[email protected]>--- chardev/char-socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)chardev/char-socket.c +2
-0@@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,"Unable to connect character device %s: " , chr->label); s->connect_err_reported = true; + }else { +error_free (err); }qemu_chr_socket_restart_timer (chr); }chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1092
Quoted 6 lines
chardev/char-socket.c +0
-1@@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)if (qio_task_propagate_error (task, &err)) {tcp_chr_change_state (s,TCP_CHARDEV_STATE_DISCONNECTED );check_report_connect_error (chr, err); -error_free (err); goto cleanup; }Reviewed-by Markus Armbruster <[email protected]>
Quoted 2 lines
and queued, thanks!
Can you please add a note to the commit message?
Errors are already freed by error_report_err, so we only need to call error_free when that function is not called.
and Cc qemu-stable? Or I can queue it too since it's chardev stuff.
Quoted 34 lines · Markus Armbruster
Quoted 30 lines
Quoted 19 lines · lichun
Signed-off-by lichun <[email protected]>---
chardev/char-socket.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)chardev/char-socket.c +2
-0@@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr, "Unable to connect character device %s: ", chr->label); s->connect_err_reported = true; + } else { + error_free(err); } qemu_chr_socket_restart_timer(chr); }chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1092
Quoted 6 lines
chardev/char-socket.c +0
-1@@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque) if (qio_task_propagate_error(task, &err)) { tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED); check_report_connect_error(chr, err); - error_free(err); goto cleanup; }Reviewed-by Markus Armbruster <[email protected]>Quoted 2 lines
and queued, thanks!
Quoted 6 lines
Can you please add a note to the commit message?
Errors are already freed by
error_report_err, so we only need to callerror_freewhen that function is not called.
and Cc qemu-stable? Or I can queue it too since it's chardev stuff.
Ok, I'll post v3.
Quoted 1 line
Quoted 34 lines · On 01/07/20 17:12, [email protected] wrote:
Quoted 34 lines · Markus Armbruster
Quoted 32 lines
Quoted 19 lines · lichun
Signed-off-by lichun <[email protected]>---
chardev/char-socket.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)chardev/char-socket.c +2
-0@@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr, "Unable to connect character device %s: ", chr->label); s->connect_err_reported = true; + } else { + error_free(err); } qemu_chr_socket_restart_timer(chr); }chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1092
Quoted 6 lines
chardev/char-socket.c +0
-1@@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque) if (qio_task_propagate_error(task, &err)) { tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED); check_report_connect_error(chr, err); - error_free(err); goto cleanup; }Reviewed-by Markus Armbruster <[email protected]>and queued, thanks!
Quoted 7 lines
Quoted 6 lines
Can you please add a note to the commit message?
Errors are already freed by
error_report_err, so we only need to callerror_freewhen that function is not called.
and Cc qemu-stable? Or I can queue it too since it's chardev stuff.Ok, I'll post v3.
No need for that, thanks! (My message was for Markus).
Paolo
Quoted 34 lines · Paolo Bonzini
Quoted 30 lines · Markus Armbruster
Quoted 19 lines · lichun
Signed-off-by lichun <[email protected]>--- chardev/char-socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)chardev/char-socket.c +2
-0@@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,"Unable to connect character device %s: " , chr->label); s->connect_err_reported = true; + }else { +error_free (err); }qemu_chr_socket_restart_timer (chr); }chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1092
Quoted 6 lines
chardev/char-socket.c +0
-1@@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)if (qio_task_propagate_error (task, &err)) {tcp_chr_change_state (s,TCP_CHARDEV_STATE_DISCONNECTED );check_report_connect_error (chr, err); -error_free (err); goto cleanup; }Reviewed-by Markus Armbruster <[email protected]>Quoted 2 lines
and queued, thanks!
Quoted 6 lines
Can you please add a note to the commit message?
Errors are already freed by
error_report_err, so we only need to callerror_freewhen that function is not called.and Cc qemu-stable? Or I can queue it too since it's chardev stuff.
Done in my tree, expect PR later today.