Permalink
Browse files

create binary string directly from pData

  • Loading branch information...
1 parent 4402370 commit 9529687d6c66a7ffbe81213ac99a543f60beab87 @mojombo mojombo committed Oct 28, 2009
Showing with 2 additions and 4 deletions.
  1. +2 −4 ext/bert/c/decode.c
View
@@ -228,10 +228,8 @@ VALUE read_bin(unsigned char **pData) {
unsigned int length = read_4(pData);
- unsigned char* buf = malloc(length + 1);
- read_string_raw(buf, pData, length);
- VALUE rStr = rb_str_new((char *) buf, length);
- free(buf);
+ VALUE rStr = rb_str_new((char *) *pData, length);
+ *pData += length;
return rStr;
}

0 comments on commit 9529687

Please sign in to comment.