[2915] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[PATCH 2/2] Should owl_zwrite_new fail to parse zaway, check the result

daemon@ATHENA.MIT.EDU (David Benjamin)
Sun Feb 20 17:36:11 2011

From: David Benjamin <davidben@MIT.EDU>
To: barnowl-dev@mit.edu
Date: Sun, 20 Feb 2011 17:36:03 -0500
In-Reply-To: <1298241363-28928-1-git-send-email-davidben@mit.edu>

In particular, should I try to reply to my good friend '-c', I might
find myself a little bit depressed. Though we ought to take care of this
case otherwise.
---
 zephyr.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/zephyr.c b/zephyr.c
index 1afb716..560bb72 100644
--- a/zephyr.c
+++ b/zephyr.c
@@ -889,13 +889,17 @@ void owl_zephyr_zaway(const owl_message *m)
   g_free(to);
 
   z = owl_zwrite_new(tmpbuff);
+  g_free(tmpbuff);
+  if (z == NULL) {
+    owl_function_error("Error creating outgoing zephyr.");
+    return;
+  }
   owl_zwrite_set_message(z, owl_global_get_zaway_msg(&g));
   owl_zwrite_set_zsig(z, "Automated reply:");
 
   /* display the message as an admin message in the receive window */
   mout=owl_function_make_outgoing_zephyr(z);
   owl_global_messagequeue_addmsg(&g, mout);
-  g_free(tmpbuff);
   owl_zwrite_delete(z);
 #endif
 }
-- 
1.7.3.3.399.g06ddf


home help back first fref pref prev next nref lref last post