Binder bugfix

This commit is contained in:
plutoo 2018-02-19 23:40:48 +01:00
parent cde07068dd
commit 6ee4d389a5

View File

@ -30,22 +30,22 @@ Result binderInitSession(Binder *session, u32 unk0)
rc = binderAdjustRefcount(session, 1, 1); rc = binderAdjustRefcount(session, 1, 1);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
rc = binderAdjustRefcount(session, -1, 0); binderAdjustRefcount(session, -1, 0);
return rc; return rc;
} }
rc = binderGetNativeHandle(session, unk0, &session->nativeHandle); rc = binderGetNativeHandle(session, unk0, &session->nativeHandle);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
rc = binderAdjustRefcount(session, -1, 1); binderAdjustRefcount(session, -1, 1);
rc = binderAdjustRefcount(session, -1, 0); binderAdjustRefcount(session, -1, 0);
return rc; return rc;
} }
// When the output nativeHandle is 0 the Binder ID is probably invalid. // When the output nativeHandle is 0 the Binder ID is probably invalid.
if(session->nativeHandle == 0) { if (session->nativeHandle == 0) {
rc = binderAdjustRefcount(session, -1, 1); binderAdjustRefcount(session, -1, 1);
rc = binderAdjustRefcount(session, -1, 0); binderAdjustRefcount(session, -1, 0);
return MAKERESULT(Module_Libnx, LibnxError_BadInput); return MAKERESULT(Module_Libnx, LibnxError_BadInput);
} }