From e5aa9e13f4e8f928ae0bbe1bb57bebe1547b371f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 14 May 2008 19:44:47 +0000 Subject: [PATCH] If an error happens during extraction of the argument vectors in _ArgvReceived(), the array elements still need to be set to NULL otherwise the function will free() random pointers at the end. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25494 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index ec31f9c5cf..ec0767df14 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -1425,7 +1425,7 @@ BApplication::_ArgvReceived(BMessage *message) if (message->FindInt32("argc", &argc) == B_OK && argc > 0) { // allocate a NULL terminated array argv = new char*[argc + 1]; - argv[argc] = NULL; + memset(argv, 0, sizeof(char*) * argc + 1); // copy the arguments for (int32 i = 0; error == B_OK && i < argc; i++) {