Author: iratqq
Date: Thu Jan 15 08:49:53 2009
New Revision: 5723

Modified:
   trunk/uim/uim-helper.c

Log:
* uim/uim-helper.c (uim_helper_buffer_append):
  - NULL check first.
  - Use uim_realloc().
  (uim_helper_buffer_get_message):
  - NULL check first.


Modified: trunk/uim/uim-helper.c
==============================================================================
--- trunk/uim/uim-helper.c      (original)
+++ trunk/uim/uim-helper.c      Thu Jan 15 08:49:53 2009
@@ -267,12 +267,12 @@
 {
   size_t buf_size, extended_size;

-  buf_size = strlen(buf);
-  extended_size = buf_size + fragment_size + 1;
-  buf = realloc(buf, extended_size);
   if (buf) {
-    memcpy(&buf[buf_size], fragment, fragment_size);
-    buf[extended_size - 1] = '\0';
+         buf_size = strlen(buf);
+         extended_size = buf_size + fragment_size + 1;
+         buf = uim_realloc(buf, extended_size);
+         memcpy(&buf[buf_size], fragment, fragment_size);
+         buf[extended_size - 1] = '\0';
   }

   return buf;
@@ -293,6 +293,9 @@
   char *msg, *msg_term;

   if (UIM_CATCH_ERROR_BEGIN())
+    return NULL;
+
+  if (!buf)
     return NULL;

   msg_term = strstr(buf, "\n\n");

Reply via email to