Revision: 7406
Author:   ek.kato
Date:     Tue Jan 10 23:00:23 2012
Log:      * Merge r7318 from trunk.

http://code.google.com/p/uim/source/detail?r=7406

Modified:
 /branches/1.7/xim/helper.cpp

=======================================
--- /branches/1.7/xim/helper.cpp        Sun May  1 21:20:23 2011
+++ /branches/1.7/xim/helper.cpp        Tue Jan 10 23:00:23 2012
@@ -108,8 +108,10 @@
            return;
        len = static_cast<int>(strlen(buf) + strlen(tmp));
        buf = (char *)realloc(buf, sizeof(char) * len + 1);
-       if (!buf)
+       if (!buf) {
+           free(tmp);
            return;
+        }
        strcat(buf, tmp);
        free(tmp);

@@ -119,8 +121,10 @@
                return;
            len = static_cast<int>(strlen(buf) + strlen(tmp));
            buf = (char *)realloc(buf, sizeof(char) * len + 1);
-           if (!buf)
+           if (!buf) {
+               free(tmp);
                return;
+            }
            strcat(buf, tmp);
            free(tmp);
        } else {
@@ -129,8 +133,10 @@
                return;
            len = static_cast<int>(strlen(buf) + strlen(tmp));
            buf = (char *)realloc(buf, sizeof(char) * len + 1);
-           if (!buf)
+           if (!buf) {
+               free(tmp);
                return;
+            }
            strcat(buf, tmp);
            free(tmp);
        }

Reply via email to