| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1ef2811 commit 95ee3b5
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -307,14 +307,13 @@ static void SetGroups(const FunctionCallbackInfo<Value>& args) { | |||
| 307 | 307 | ||
| 308 | 308 | Local<Array> groups_list = args[0].As<Array>(); | |
| 309 | 309 | size_t size = groups_list->Length(); | |
| 310 | - gid_t* groups = new gid_t[size]; | ||
| 310 | + MaybeStackBuffer<gid_t, 64> groups(size); | ||
| 311 | 311 | ||
| 312 | 312 | for (size_t i = 0; i < size; i++) { | |
| 313 | 313 | gid_t gid = gid_by_name( | |
| 314 | 314 | env->isolate(), groups_list->Get(env->context(), i).ToLocalChecked()); | |
| 315 | 315 | ||
| 316 | 316 | if (gid == gid_not_found) { | |
| 317 | - delete[] groups; | ||
| 318 | 317 | // Tells JS to throw ERR_INVALID_CREDENTIAL | |
| 319 | 318 | args.GetReturnValue().Set(static_cast<uint32_t>(i + 1)); | |
| 320 | 319 | return; | |
@@ -323,8 +322,7 @@ static void SetGroups(const FunctionCallbackInfo<Value>& args) { | |||
| 323 | 322 | groups[i] = gid; | |
| 324 | 323 | } | |
| 325 | 324 | ||
| 326 | - int rc = setgroups(size, groups); | ||
| 327 | - delete[] groups; | ||
| 325 | + int rc = setgroups(size, *groups); | ||
| 328 | 326 | ||
| 329 | 327 | if (rc == -1) return env->ThrowErrnoException(errno, "setgroups"); | |
| 330 | 328 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments