]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/utf8.c
basic/utf8: reduce memory usage
[thirdparty/systemd.git] / src / basic / utf8.c
index e12876962d6f6434ca7ce5ede58c8a997302b9d9..afc24700dd77a786d8cf9392916dece1b3785c3a 100644 (file)
@@ -32,6 +32,7 @@
 #include "gunicode.h"
 #include "hexdecoct.h"
 #include "macro.h"
+#include "string-util.h"
 #include "utf8.h"
 
 bool unichar_is_valid(char32_t ch) {
@@ -192,7 +193,7 @@ char *utf8_escape_invalid(const char *str) {
         }
 
         *s = '\0';
-
+        (void) str_realloc(&p);
         return p;
 }
 
@@ -278,6 +279,7 @@ char *utf8_escape_non_printable_full(const char *str, size_t console_width) {
 
  finish:
         *s = '\0';
+        (void) str_realloc(&p);
         return p;
 }