Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use LocalBuffer to free the buffer at any exit point of Float::from_cstr

  • Loading branch information...
commit 23ab7e926dc3be44c99d102adcbae8787828a7f2 1 parent 413fbbe
@zaeleus authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 vm/builtin/float.cpp
View
7 vm/builtin/float.cpp
@@ -21,6 +21,8 @@
#include "missing/math.h"
+#include "util/local_buffer.hpp"
+
namespace rubinius {
void Float::init(STATE) {
@@ -85,7 +87,8 @@ namespace rubinius {
str++;
}
- char* buffer = (char*)malloc(strlen(str) + 1);
+ LocalBuffer b(strlen(str) + 1);
+ char* buffer = (char*)b.buffer;
char* p = buffer;
char prev = '\0';
@@ -190,8 +193,6 @@ namespace rubinius {
}
}
- free(buffer);
-
return Float::create(state, value);
}
Please sign in to comment.
Something went wrong with that request. Please try again.