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

Commit a7a5cd6f authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by android-build-merger
Browse files

Merge "Fix leak of DhcpServer on tethering stop error" am: 7e5a5a69 am: 7afb3678 am: fe1ad3d0

am: 1db2780c

Change-Id: Ib493cc793f6284a70db786257838ae9586f2b8f5
parents d87b4faa 1db2780c
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -433,6 +433,9 @@ public class IpServer extends StateMachine {
                }
            }
            ifcg.clearFlag("running");

            // TODO: this may throw if the interface is already gone. Do proper handling and
            // simplify the DHCP server start/stop.
            mNMService.setInterfaceConfig(mIfaceName, ifcg);

            if (!configureDhcp(enabled, (Inet4Address) addr, prefixLen)) {
@@ -440,6 +443,14 @@ public class IpServer extends StateMachine {
            }
        } catch (Exception e) {
            mLog.e("Error configuring interface " + e);
            if (!enabled) {
                try {
                    // Calling stopDhcp several times is fine
                    stopDhcp();
                } catch (Exception dhcpError) {
                    mLog.e("Error stopping DHCP", dhcpError);
                }
            }
            return false;
        }