Ignore:
Timestamp:
Aug 11, 2009, 11:22:41 PM (16 years ago)
Author:
[email protected]
Message:

Make it harder to misuse try* allocation routines
https://bugs.webkit.org/show_bug.cgi?id=27469

Reviewed by Gavin Barraclough

Jump through a few hoops to make it much harder to accidentally
miss null-checking of values returned by the try-* allocation
routines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/UString.h

    r46180 r47092  
    9292                // Guard against integer overflow
    9393                if (size < (std::numeric_limits<size_t>::max() / sizeof(UChar))) {
    94                     if (void * buf = tryFastMalloc(size * sizeof(UChar)))
     94                    void * buf = 0;
     95                    if (tryFastMalloc(size * sizeof(UChar)).getValue(buf))
    9596                        return adoptRef(new BaseString(static_cast<UChar*>(buf), 0, size));
    9697                }
Note: See TracChangeset for help on using the changeset viewer.