Merge pull request 'Fix for memory leak' (#75) from YanTheKaller/libublsettings:master into master

Reviewed-on: #75
pull/77/head^2 v1.70
Dmitry Razumov 3 months ago
commit eed8f36a5f

@ -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) 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); char *ch = malloc(i * sizeof(char));
memset(ch,0,i * sizeof(char) + 1); memset(ch,0,i * sizeof(char));
sprintf(ch, "%d", int_to_convert); sprintf(ch, "%d", int_to_convert);
return ch; return ch;
} }

Loading…
Cancel
Save