Skip to content

Commit 9ae28c3

Browse files
San-titogwanglst
authored andcommitted
new does not return nullptr on failure
1 parent 556b413 commit 9ae28c3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <sys/stat.h>
2626
#include <stdio.h>
2727
#include <stdlib.h>
28+
#include <new>
2829

2930

3031
//#define WANT_LSAN 1
@@ -57,7 +58,7 @@ extern "C" int __lsan_is_turned_off() { return ls_lsan_off; }
5758
static LshttpdMain *s_pLshttpd = NULL;
5859
int main(int argc, char *argv[])
5960
{
60-
s_pLshttpd = new LshttpdMain();
61+
s_pLshttpd = new (std::nothrow) LshttpdMain();
6162
if (!s_pLshttpd)
6263
{
6364
perror("new LshttpdMain()");

0 commit comments

Comments
 (0)