Commit 2b3cb54d authored by Kim F. Storm's avatar Kim F. Storm
Browse files

(casify_object): Use SAFE_ALLOCA.

parent f61bef8b
...@@ -110,8 +110,12 @@ casify_object (flag, obj) ...@@ -110,8 +110,12 @@ casify_object (flag, obj)
/* The work is not yet finished because of a multibyte /* The work is not yet finished because of a multibyte
character just encountered. */ character just encountered. */
int fromlen, j_byte = i; int fromlen, j_byte = i;
char *buf char *buf;
= (char *) alloca ((len - i) * MAX_MULTIBYTE_LENGTH + i); int bufsize;
USE_SAFE_ALLOCA;
bufsize = (len - i) * MAX_MULTIBYTE_LENGTH + i;
SAFE_ALLOCA (buf, char *, bufsize);
/* Copy data already handled. */ /* Copy data already handled. */
bcopy (SDATA (obj), buf, i); bcopy (SDATA (obj), buf, i);
...@@ -133,6 +137,7 @@ casify_object (flag, obj) ...@@ -133,6 +137,7 @@ casify_object (flag, obj)
} }
obj = make_multibyte_string (buf, SCHARS (obj), obj = make_multibyte_string (buf, SCHARS (obj),
j_byte); j_byte);
SAFE_FREE (bufsize);
} }
return obj; return obj;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment