Mercurial > emacs
changeset 23901:974c8a7b79e8
(Fbase64_decode_region, Fbase64_decode_string):
Do free malloc'd memory even in case of failure.
Use xfree, not free.
(Fbase64_encode_region, Fbase64_encode_string):
Use xfree, not free.
(base64_decode_1): Don't fail for short lines.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 16 Dec 1998 06:32:39 +0000 |
parents | 212a00c75674 |
children | 1c12a73f742d |
files | src/fns.c |
diffstat | 1 files changed, 15 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fns.c Tue Dec 15 12:58:37 1998 +0000 +++ b/src/fns.c Wed Dec 16 06:32:39 1998 +0000 @@ -2859,7 +2859,7 @@ SET_PT_BOTH (XFASTINT (beg), ibeg); insert (encoded, encoded_length); if (allength > MAX_ALLOCA) - free (encoded); + xfree (encoded); del_range_byte (ibeg + encoded_length, iend + encoded_length, 1); /* If point was outside of the region, restore it exactly; else just @@ -2902,7 +2902,7 @@ encoded_string = make_unibyte_string (encoded, encoded_length); if (allength > MAX_ALLOCA) - free (encoded); + xfree (encoded); return encoded_string; } @@ -3013,8 +3013,12 @@ abort (); if (decoded_length < 0) - /* The decoding wasn't possible. */ - return Qnil; + { + /* The decoding wasn't possible. */ + if (length > MAX_ALLOCA) + xfree (decoded); + return Qnil; + } /* Now we have decoded the region, so we insert the new contents and delete the old. (Insert first in order to preserve markers.) */ @@ -3027,7 +3031,7 @@ insert (decoded, decoded_length); inserted_chars = PT - (XFASTINT (beg) + 1); if (length > MAX_ALLOCA) - free (decoded); + xfree (decoded); /* At first delete the original text. This never cause byte combining. */ del_range_both (PT + 1, PT_BYTE + 1, XFASTINT (end) + inserted_chars + 2, @@ -3073,11 +3077,13 @@ abort (); if (decoded_length < 0) - return Qnil; - - decoded_string = make_string (decoded, decoded_length); + /* The decoding wasn't possible. */ + decoded_string = Qnil; + else + decoded_string = make_string (decoded, decoded_length); + if (length > MAX_ALLOCA) - free (decoded); + xfree (decoded); return decoded_string; } @@ -3105,8 +3111,6 @@ c = from[i++]; if (i == length) break; - if (counter != MIME_LINE_LENGTH / 4) - return -1; counter = 1; } else