Bug 1287361 - Add a missing XPT_CALLOC8 null check. r=khuey.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 18 Jul 2016 14:18:19 +1000
changeset 330740 2ca8ada54b9b1d2c5805077e3cf28142bcc5b612
parent 330739 fbe15803100288c74cc3a0e8c54585c88fe1b454
child 330741 df35aa6dffb62d73cbc404094e2cf5ee147bf587
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1287361
milestone50.0a1
Bug 1287361 - Add a missing XPT_CALLOC8 null check. r=khuey.
xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
--- a/xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
@@ -17,16 +17,19 @@ using namespace mozilla;
 /* static */ xptiInterfaceEntry*
 xptiInterfaceEntry::Create(const char* name, const nsID& iid,
                            XPTInterfaceDescriptor* aDescriptor,
                            xptiTypelibGuts* aTypelib)
 {
     int namelen = strlen(name);
     void* place =
         XPT_CALLOC8(gXPTIStructArena, sizeof(xptiInterfaceEntry) + namelen);
+    if (!place) {
+        return nullptr;
+    }
     return new (place) xptiInterfaceEntry(name, namelen, iid, aDescriptor,
                                           aTypelib);
 }
 
 xptiInterfaceEntry::xptiInterfaceEntry(const char* name,
                                        size_t nameLength,
                                        const nsID& iid,
                                        XPTInterfaceDescriptor* aDescriptor,