Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82afbe22 authored by Marco Nelissen's avatar Marco Nelissen Committed by android-build-merger
Browse files

Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c am:...

Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c am: 275c9f60 am: 853702ce
am: 775f2e6d

* commit '775f2e6d':
  Correctly handle dup() failure in Parcel::readNativeHandle

Change-Id: Ibfc37203a33c603df365ed9cbb85632d34acafbd
parents 5ad8d443 775f2e6d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1221,7 +1221,13 @@ native_handle* Parcel::readNativeHandle() const

    for (int i=0 ; err==NO_ERROR && i<numFds ; i++) {
        h->data[i] = dup(readFileDescriptor());
        if (h->data[i] < 0) err = BAD_VALUE;
        if (h->data[i] < 0) {
            for (int j = 0; j < i; j++) {
                close(h->data[j]);
            }
            native_handle_delete(h);
            return 0;
        }
    }
    err = read(h->data + numFds, sizeof(int)*numInts);
    if (err != NO_ERROR) {