potracer 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/ext/potracer/potracer.c +5 -1
  2. metadata +1 -1
@@ -169,6 +169,7 @@ trace_as_svg (VALUE klass)
169
169
  FILE *out = tmpfile();
170
170
  char *out_buffer;
171
171
  long size;
172
+ VALUE svg;
172
173
  potrace_path_t *path;
173
174
  int i, num_segments, *tag;
174
175
  potrace_dpoint_t (*c)[3];
@@ -205,7 +206,9 @@ trace_as_svg (VALUE klass)
205
206
  rewind(out);
206
207
  fread(out_buffer, 1, size, out);
207
208
  fclose(out);
208
- return rb_str_new2(out_buffer);
209
+ svg = rb_str_new(out_buffer, size);
210
+ xfree(out_buffer);
211
+ return svg;
209
212
  }
210
213
 
211
214
  static VALUE
@@ -283,6 +286,7 @@ bitmap_new (int argc, VALUE *argv, VALUE klass)
283
286
  bm->h = (argc > 1) ? NUM2INT(argv[1]) : BM_HEIGHT;
284
287
  bm->dy = (bm->w + BM_WORDBITS - 1) / BM_WORDBITS;
285
288
  bm->map = ALLOC_N(potrace_word, bm->dy * bm->h * BM_WORDSIZE);
289
+ memset(bm->map, 0, bm->dy * bm->h * BM_WORDSIZE);
286
290
 
287
291
  if (argc > 2) {
288
292
  if (T_STRING == TYPE(argv[2])) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: potracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: