qemu-ga: Fix null pointer passed to unlink in failure branch
PATCH 1/1 qemu-ga: Fix null pointer passed to unlink in failure branch
Clang reports this warning:
Null pointer passed as an argument to a 'nonnull' parameter
Signed-off-by Stefan Weil <[email protected]>
--- qemu-ga.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
qemu-ga.c +3 -1
@@ -438,7 +438,9 @@ static void become_daemon(const char *pidfile)return ; fail: -unlink (pidfile); +if (pidfile) { +unlink (pidfile); + }g_critical ("failed to daemonize" );exit (EXIT_FAILURE );#endif
Signature · 1 line
1.7.10
Stefan Hajnoczi
AppliedQuoted 8 lines · Stefan Weil
Clang reports this warning:
Null pointer passed as an argument to a 'nonnull' parameter
Signed-off-by Stefan Weil <[email protected]>--- qemu-ga.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Nice, this looks like a legitimate bug that was detected by clang. We call become_daemon(NULL).
Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches
Stefan
Quoted 5 lines · On Fri, 24 Aug 2012 07:03:03 +0200 Stefan Weil <[email protected]> wrote:
Clang reports this warning:
Null pointer passed as an argument to a 'nonnull' parameter
Signed-off-by Stefan Weil <[email protected]>
Reviewed-by Luiz Capitulino <[email protected]>
Quoted 19 lines
--- qemu-ga.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)qemu-ga.c +3
-1@@ -438,7 +438,9 @@ static void become_daemon(const char *pidfile)return ; fail: -unlink (pidfile); +if (pidfile) { +unlink (pidfile); + }g_critical ("failed to daemonize" );exit (EXIT_FAILURE );#endif