[PATCH weston] compositor-rdp: free() can handle NULL pointers

Dawid Gajownik gajownik at gmail.com
Sat Aug 1 07:02:54 PDT 2015


There's no need to check if a pointer exists before passing it to free().
free() can handle NULL pointers.

Signed-off-by: Dawid Gajownik <gajownik at gmail.com>
---
 src/compositor-rdp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index a83948b..b5169a8 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -1244,12 +1244,9 @@ err_output:
 err_compositor:
 	weston_compositor_shutdown(compositor);
 err_free_strings:
-	if (b->rdp_key)
-		free(b->rdp_key);
-	if (b->server_cert)
-		free(b->server_cert);
-	if (b->server_key)
-		free(b->server_key);
+	free(b->rdp_key);
+	free(b->server_cert);
+	free(b->server_key);
 	free(b);
 	return NULL;
 }
-- 
2.4.3



More information about the wayland-devel mailing list