We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d440ea1 + c843627 commit b080622Copy full SHA for b080622
1 file changed
generate/templates/manual/src/str_array_converter.cc
@@ -25,17 +25,15 @@ git_strarray *StrArrayConverter::Convert(Handle<v8::Value> val) {
25
}
26
27
git_strarray *StrArrayConverter::ConvertArray(Array *val) {
28
- int count = val->Length();
29
- char **strings = (char **)malloc(sizeof(char*) * count);
30
- git_strarray *result;
+ git_strarray *result = (git_strarray *)malloc(sizeof(git_strarray*));
+ result->count = val->Length();
+ result->strings = (char **)malloc(sizeof(char*) * result->count);
31
32
- for(int i = 0; i < count; i++) {
+ for(size_t i = 0; i < result->count; i++) {
33
NanUtf8String entry(val->Get(i));
34
- strings[i] = *entry;
+ result->strings[i] = strdup(*entry);
35
36
37
- result = ConstructStrArray(count, strings);
38
- free(strings);
39
return result;
40
41
0 commit comments