VirtualBox

Changeset 6920 in vbox for trunk/src/libs


Ignore:
Timestamp:
Feb 12, 2008 1:16:28 PM (17 years ago)
Author:
vboxsync
Message:

XPCOM/IPC/DConnect: For zero-sized arrays, we use the size of 1 because whether malloc(0) returns a null pointer or not (which is used in isNull()) is implementation-dependent according to the C standard.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp

    r6850 r6920  
    10531053      return rv;
    10541054
    1055   void *arr = nsMemory::Alloc(size * elemSize);
     1055  // Note: for zero-sized arrays, we use the size of 1 because whether
     1056  // malloc(0) returns a null pointer or not (which is used in isNull())
     1057  // is implementation-dependent according to the C standard
     1058  void *arr = nsMemory::Alloc((size ? size : 1) * elemSize);
    10561059  if (arr == nsnull)
    10571060    return NS_ERROR_OUT_OF_MEMORY;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette