plugins: Fix some resource leaks
v3 cover plugins: Fix some resource leaks
There are 3 resource leaks in contrib/plugins/lockstep.c, fix it.
v2->v3:
- change the "From" line to "Alex Chen"
v1->v2:
- add the cover letter
- modify the subject of the patch[2/2]
Alex Chen (2):
plugins: Fix resource leak in connect_socket()
plugins: Fix two resource leaks in setup_socket()
contrib/plugins/lockstep.c | 3 +++ 1 file changed, 3 insertions(+)
Signature · 1 line
2.19.1
PATCH v3 1/2 plugins: Fix resource leak in connect_socket()
Close the fd when the connect() fails.
--- contrib/plugins/lockstep.c | 1 + 1 file changed, 1 insertion(+)
contrib/plugins/lockstep.c +1 -0
@@ -292,6 +292,7 @@ static bool connect_socket(const char *path)if (connect (fd, (struct sockaddr *)&sockaddr,sizeof (sockaddr)) <0 ) {perror ("failed to connect" ); +close (fd);return false; }
Signature · 1 line
2.19.1
PATCH v3 2/2 plugins: Fix two resource leaks in setup_socket()
In reply to Alex ChenEither accept() fails or exits normally, we need to close the fd.
--- contrib/plugins/lockstep.c | 2 ++ 1 file changed, 2 insertions(+)
contrib/plugins/lockstep.c +2 -0
@@ -268,11 +268,13 @@ static bool setup_socket(const char *path) socket_fd =accept (fd,NULL ,NULL );if (socket_fd <0 && errno !=EINTR ) {perror ("accept socket" ); +close (fd);return false; }qemu_plugin_outs ("setup_socket::ready\n" ); +close (fd);return true; }
Signature · 1 line
2.19.1
Alex Bennée
AppliedQuoted 1 line · Alex Chen
There are 3 resource leaks in
contrib/plugins/lockstep.c, fix it.
Queued to for-5.2/various-fixes, thanks.
Quoted 14 lines
v2->v3:
- change the "From" line to "Alex Chen"
v1->v2:
- add the cover letter
- modify the subject of the patch[2/2]Alex Chen (2):
plugins: Fix resource leak inconnect_socket()
plugins: Fix two resource leaks insetup_socket()contrib/plugins/lockstep.c | 3 +++ 1 file changed, 3 insertions(+)
Signature · 1 line
Alex Bennée