Skip to content

Commit

Permalink
Fix lint warning releated to potential leak (#29715)
Browse files Browse the repository at this point in the history
NsdManagerServiceBrowser.java:51: Error: The WIFI_SERVICE must be looked up on the Application context or memory will leak on devices < Android N. Try changing context to context.getApplicationContext() [WifiManagerPotentialLeak]

Apply the recommendation from this check.
  • Loading branch information
mspang authored Oct 12, 2023
1 parent 2e177f4 commit 0b2cfab
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public NsdManagerServiceBrowser(Context context) {
this.mainThreadHandler = new Handler(Looper.getMainLooper());

this.multicastLock =
((WifiManager) context.getSystemService(Context.WIFI_SERVICE))
((WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE))
.createMulticastLock("chipBrowseMulticastLock");
this.multicastLock.setReferenceCounted(true);
callbackMap = new HashMap<>();
Expand Down

0 comments on commit 0b2cfab

Please sign in to comment.