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
This commit is contained in:
Stephan Aßmus 2008-05-14 19:44:47 +00:00
parent 0899ad23e2
commit e5aa9e13f4

View File

@ -1425,7 +1425,7 @@ BApplication::_ArgvReceived(BMessage *message)
if (message->FindInt32("argc", &argc) == B_OK && argc > 0) { if (message->FindInt32("argc", &argc) == B_OK && argc > 0) {
// allocate a NULL terminated array // allocate a NULL terminated array
argv = new char*[argc + 1]; argv = new char*[argc + 1];
argv[argc] = NULL; memset(argv, 0, sizeof(char*) * argc + 1);
// copy the arguments // copy the arguments
for (int32 i = 0; error == B_OK && i < argc; i++) { for (int32 i = 0; error == B_OK && i < argc; i++) {