RESTRICT AUTOMERGE: Fix the error and make the argument nonnull
When trying to add nullability annotations to arguments in aosp/2381752,
conflicts come up.
See detail in https://android-build.googleplex.com/builds/pending/P47788031/aosp_bramble-userdebug/latest/view/logs/build.log
Bug: b/245972273
Test: atest mtp_ffs_handle_test
Change-Id: I841c57a404dbd0ee143257fe9106e3bcecbc8b3d
Merged-In: I841c57a404dbd0ee143257fe9106e3bcecbc8b3d
(cherry picked from commit 8ee5768bf8d5683f5e1b9711fd9b2447629c0b41)
diff --git a/media/mtp/MtpFfsHandle.cpp b/media/mtp/MtpFfsHandle.cpp
index 2ffd775..b72fcfb 100644
--- a/media/mtp/MtpFfsHandle.cpp
+++ b/media/mtp/MtpFfsHandle.cpp
@@ -362,10 +362,12 @@
void MtpFfsHandle::cancelTransaction() {
// Device cancels by stalling both bulk endpoints.
- if (::read(mBulkIn, nullptr, 0) != -1 || errno != EBADMSG)
+ void *buf = malloc(sizeof(char));
+ if (::read(mBulkIn, buf, 0) != -1 || errno != EBADMSG)
PLOG(ERROR) << "Mtp stall failed on bulk in";
- if (::write(mBulkOut, nullptr, 0) != -1 || errno != EBADMSG)
+ if (::write(mBulkOut, buf, 0) != -1 || errno != EBADMSG)
PLOG(ERROR) << "Mtp stall failed on bulk out";
+ free(buf);
mCanceled = true;
errno = ECANCELED;
}