utils: better error handling

This commit is contained in:
Boris Faure 2023-08-17 12:57:29 +02:00
parent f4beb146d3
commit 127beea28b
Signed by: borisfaure
GPG Key ID: EAA9CD729F522998
1 changed files with 8 additions and 1 deletions

View File

@ -88,10 +88,17 @@ ty_eina_unicode_base64_encode(Eina_Unicode *unicode)
src = eina_unicode_unicode_to_utf8(unicode, &utf8_len);
bb = eina_binbuf_manage_new((const unsigned char*)src, utf8_len, EINA_FALSE);
if (!bb)
{
free(src);
return NULL;
}
sb = emile_base64_encode(bb);
eina_binbuf_free(bb);
if (!sb)
return NULL;
res = (char*) eina_strbuf_string_steal(sb);
eina_strbuf_free(sb);
return res;