nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0046fa0
)
lib/standard/time: Fixed String-related memory leak
author
Lucas Bajolet
<r4pass@hotmail.com>
Tue, 3 Feb 2015 21:47:39 +0000
(16:47 -0500)
committer
Lucas Bajolet
<r4pass@hotmail.com>
Thu, 5 Feb 2015 16:08:57 +0000
(11:08 -0500)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/standard/time.nit
patch
|
blob
|
history
diff --git
a/lib/standard/time.nit
b/lib/standard/time.nit
index
09e8389
..
e0b3867
100644
(file)
--- a/
lib/standard/time.nit
+++ b/
lib/standard/time.nit
@@
-135,7
+135,9
@@
extern class Tm `{struct tm *`}
c_format = String_to_cstring(format);
res = strftime(buf, 100, c_format, recv);
- return NativeString_to_s(buf);
+ String s = NativeString_to_s_with_copy(buf);
+ free(buf);
+ return s;
`}
redef fun to_s do return asctime.replace("\n", "")