GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: fix double free reported by coverity · nodejs/node@9b7f79a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_internals.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_internals.h‎

Copy file name to clipboardExpand all lines: src/node_internals.h
+5-8Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,13 @@ static v8::MaybeLocal<v8::Object> New(Environment* env,
192192
char* src = reinterpret_cast<char*>(buf->out());
193193
const size_t len_in_bytes = buf->length() * sizeof(buf->out()[0]);
194194

195-
if (buf->IsAllocated())
195+
if (buf->IsAllocated()) {
196196
ret = New(env, src, len_in_bytes);
197-
else if (!buf->IsInvalidated())
198-
ret = Copy(env, src, len_in_bytes);
199-
200-
if (ret.IsEmpty())
201-
return ret;
202-
203-
if (buf->IsAllocated())
197+
// new always takes ownership of src
204198
buf->Release();
199+
} else if (!buf->IsInvalidated()) {
200+
ret = Copy(env, src, len_in_bytes);
201+
}
205202

206203
return ret;
207204
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.