[network] When IP is not set don't assume certain interface.

When ip is not set the default interface was assumed to be usb0.
Also do proper cleaning in the end to ensure that memory is not leaked.

Signed-off-by: Marko Saukko <marko.saukko@jollamobile.com>