]> granicus.if.org Git - onig/commitdiff
fix memory leak in onig_unicode_define_user_property()
authorkosako <kosako@sofnec.co.jp>
Mon, 23 May 2016 05:52:03 +0000 (14:52 +0900)
committerkosako <kosako@sofnec.co.jp>
Mon, 23 May 2016 05:52:03 +0000 (14:52 +0900)
src/unicode.c

index 1aa375bc1f746e05689f6c2eadc53428a28dec06..8812ca2fd0f308633973e3ad9592a50056707a41 100644 (file)
@@ -111,8 +111,10 @@ onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges)
   n = 0;
   for (i = 0; i < len; i++) {
     c = name[i];
-    if (c <= 0 || c >= 0x80)
+    if (c <= 0 || c >= 0x80) {
+      xfree(s);
       return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
+    }
 
     if (c != ' ' && c != '-' && c != '_') {
       s[n] = c;