sinaweibosdk/weibo_android_sdk

sdk里的MeizuImpl等类里的doGet没有关闭sql的Cursor,导致泄漏

TomesVWhite opened this issue · 0 comments

2022-04-24 19:51:01.322 16077-16087/com.netease.cloudmusic E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
    java.lang.Throwable: Explicit termination method 'close' not called
        at dalvik.system.CloseGuard.open(CloseGuard.java:180)
        at android.database.CursorWindow.<init>(CursorWindow.java:141)
        at android.database.CursorWindow.<init>(CursorWindow.java)
        at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:685)
        at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:684)
        at android.database.CursorWindow.newFromParcel(CursorWindow.java:694)
        at android.database.BulkCursorProxy.getWindow(BulkCursorNative.java:168)
        at android.database.BulkCursorToCursorAdaptor.onMove(BulkCursorToCursorAdaptor.java:82)
        at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:236)
        at android.database.AbstractCursor.moveToFirst(AbstractCursor.java:258)
        at android.database.CursorWrapper.moveToFirst(CursorWrapper.java:71)
        at com.weibo.ssosdk.oaid.impl.MeizuImpl.doGet(Unknown Source)

反编译后的源码

    public void doGet(IGetter var1) {
        Uri var2 = Uri.parse("content://com.meizu.flyme.openidsdk/");

        try {
            //var4没有处理关闭,导致泄漏
            Cursor var4;
            ((Cursor)Objects.requireNonNull(var4 = this.context.getContentResolver().query(var2, (String[])null, (String)null, new String[]{"oaid"}, (String)null))).moveToFirst();
            String var5;
            if ((var5 = var4.getString(var4.getColumnIndex("value"))) != null && var5.length() != 0) {
                var1.onOAIDGetComplete(var5);
            } else {
                throw new OAIDException("OAID query failed");
            }
        } catch (Exception var3) {
            var1.onOAIDGetError(var3);
        }
    }

希望团队能尽快修复这一类问题