From 94db8460cc940bdece2695d37f1a6ed99ca3a6fc Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Tue, 10 Feb 2026 17:34:56 +0600 Subject: [PATCH] Fix for memory leak --- source/libublsettings-char.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libublsettings-char.c b/source/libublsettings-char.c index 1ef29c6..cc9d3b3 100644 --- a/source/libublsettings-char.c +++ b/source/libublsettings-char.c @@ -248,10 +248,10 @@ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) char *yon_char_from_int(int int_to_convert) { - int i = snprintf( NULL, 0, "%d", int_to_convert ); + int i = snprintf( NULL, 0, "%d", int_to_convert)+1; - char *ch = malloc(i * sizeof(char) + 1+ int_to_convert<0?1:0); - memset(ch,0,i * sizeof(char) + 1); + char *ch = malloc(i * sizeof(char)); + memset(ch,0,i * sizeof(char)); sprintf(ch, "%d", int_to_convert); return ch; }