Closed Bug 1528019 Opened 6 years ago Closed 6 years ago

DataStorage: if NS_NewNamedThread fails, gDataStorageSharedThread leaks

Categories

(Core :: Security: PSM, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1527372

People

(Reporter: keeler, Unassigned)

Details

(Whiteboard: [psm-cleanup])

static DataStorageSharedThread* gDataStorageSharedThread;
static bool gDataStorageSharedThreadShutDown = false;

nsresult DataStorageSharedThread::Initialize() {
  MOZ_ASSERT(XRE_IsParentProcess());
  StaticMutexAutoLock lock(sDataStorageSharedThreadMutex);

  // If this happens, we initialized a DataStorage after shutdown notifications
  // were sent, so don't re-initialize the shared thread.
  if (gDataStorageSharedThreadShutDown) {
    return NS_ERROR_FAILURE;
  }

  if (!gDataStorageSharedThread) {
    gDataStorageSharedThread = new DataStorageSharedThread();
    nsresult rv = NS_NewNamedThread(
        "DataStorage", getter_AddRefs(gDataStorageSharedThread->mThread));
    if (NS_FAILED(rv)) {
      gDataStorageSharedThread = nullptr;
      return rv;
    }

Bug 1527372 fixed this.

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.