Hi

Fixes a Clang warning. If pr is NULL, the final return would crash.

- Lauri
>From ef0c967515dc5f608c24a7c909718ab50cfde5e2 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <[email protected]>
Date: Wed, 23 May 2012 18:03:11 +0300
Subject: [PATCH 11/13] palm: Prevent possible crash

Fixes a Clang warning. If pr is NULL, the final return would crash.

Signed-off-by: Lauri Kasanen <[email protected]>
---
 plugins/palm/palm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/plugins/palm/palm.c b/plugins/palm/palm.c
index c324726..5be64ce 100644
--- a/plugins/palm/palm.c
+++ b/plugins/palm/palm.c
@@ -335,7 +335,9 @@ int mk_palm_send_request(struct client_session *cs, struct 
session_request *sr)
     pr = mk_palm_request_get_by_http(cs->socket);
     PLUGIN_TRACE("[FD %i] Sending request to Palm Server", pr->palm_fd);
 
-    if (pr && pr->bytes_sent == 0) {
+    if (!pr) return -1;
+
+    if (pr->bytes_sent == 0) {
         PLUGIN_TRACE("Palm request: '%s'", sr->real_path.data);
 
         /* Create protocol request  */
-- 
1.7.2.1

_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to