mirror of
https://github.com/RubyMetric/chsrc
synced 2026-01-12 15:28:25 +08:00
修复 xy_file_to_str 的内存泄露
This commit is contained in:
2
lib/xy.h
2
lib/xy.h
@@ -745,7 +745,7 @@ xy_file_read (const char *path)
|
|||||||
buf[read_bytes] = '\0';
|
buf[read_bytes] = '\0';
|
||||||
|
|
||||||
char *formatted_str = xy_str_gsub (buf, "\r\n", "\n");
|
char *formatted_str = xy_str_gsub (buf, "\r\n", "\n");
|
||||||
formatted_str = xy_str_gsub (formatted_str, "\r", "\n");
|
xy_str_swap (&formatted_str, xy_str_gsub (formatted_str, "\r", "\n"));
|
||||||
|
|
||||||
free (buf);
|
free (buf);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user