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

Commit decfe737 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Bluetooth: Cleaning up cursor object to avoid memory leak"

parents 2de38b3b cc92c962
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -305,6 +305,8 @@ class BluetoothOppNotification {
            }
        }
        cursor.close();
        if (V) Log.v(TAG, "Freeing cursor: " + cursor);
        cursor = null;

        // Add the notifications
        for (NotificationItem item : mNotifications.values()) {
@@ -427,6 +429,8 @@ class BluetoothOppNotification {
        }
        if (V) Log.v(TAG, "outbound: succ-" + outboundSuccNumber + "  fail-" + outboundFailNumber);
        cursor.close();
        if (V) Log.v(TAG, "Freeing cursor: " + cursor);
        cursor = null;

        outboundNum = outboundSuccNumber + outboundFailNumber;
        // create the outbound notification
@@ -480,6 +484,8 @@ class BluetoothOppNotification {
        }
        if (V) Log.v(TAG, "inbound: succ-" + inboundSuccNumber + "  fail-" + inboundFailNumber);
        cursor.close();
        if (V) Log.v(TAG, "Freeing cursor: " + cursor);
        cursor = null;

        inboundNum = inboundSuccNumber + inboundFailNumber;
        // create the inbound notification
@@ -552,5 +558,7 @@ class BluetoothOppNotification {
            mNotificationMgr.notify(id, n);
        }
        cursor.close();
        if (V) Log.v(TAG, "Freeing cursor: " + cursor);
        cursor = null;
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -115,6 +115,8 @@ public class BluetoothOppReceiveFileInfo {
                }
            } finally {
                metadataCursor.close();
                if (V) Log.v(Constants.TAG, "Freeing cursor: " + metadataCursor);
                metadataCursor = null;
            }
        }

+2 −0
Original line number Diff line number Diff line
@@ -227,6 +227,8 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
                        }
                }
                cursor.close();
                if (V) Log.v(TAG, "Freeing cursor: " + cursor);
                cursor = null;
            }
        } else if (action.equals(Constants.ACTION_COMPLETE_HIDE)) {
            if (V) Log.v(TAG, "Receiver ACTION_COMPLETE_HIDE");
+6 −0
Original line number Diff line number Diff line
@@ -627,6 +627,8 @@ public class BluetoothOppService extends Service {
                mNotifier.updateNotification();

                cursor.close();
                if (V) Log.v(TAG, "Freeing cursor: " + cursor);
                cursor = null;
            }
        }

@@ -1059,6 +1061,8 @@ public class BluetoothOppService extends Service {
                if (V) Log.v(TAG, "Delete aborted inbound share, number = " + delNum);
            }
            cursorToFile.close();
            if (V) Log.v(TAG, "Freeing cursor: " + cursorToFile);
            cursorToFile = null;
        }

        // on boot : remove unconfirmed inbound shares.
@@ -1101,6 +1105,8 @@ public class BluetoothOppService extends Service {
            }
        }
        cursor.close();
        if (V) Log.v(TAG, "Freeing cursor: " + cursor);
        cursor = null;
    }

    private static class MediaScannerNotifier implements MediaScannerConnectionClient {
+4 −0
Original line number Diff line number Diff line
@@ -129,6 +129,8 @@ public class BluetoothOppUtility {
                            + info.mDestAddr);
            }
            cursor.close();
            if (V) Log.v(TAG, "Freeing cursor: " + cursor);
            cursor = null;
        } else {
            info = null;
            if (V) Log.v(TAG, "BluetoothOppManager Error: not got data from db for uri:" + uri);
@@ -171,6 +173,8 @@ public class BluetoothOppUtility {
            if (V) Log.d(TAG, "Uri in this batch: " + path.toString());
        }
        metadataCursor.close();
        if (V) Log.v(TAG, "Freeing cursor: " + metadataCursor);
        metadataCursor = null;
        return uris;
    }