fix a null pointer deref bug
[project/netifd.git] / proto-shell.c
index bb42c98..7acb4c6 100644 (file)
@@ -137,7 +137,8 @@ proto_shell_teardown_cb(struct uloop_process *p, int ret)
 
        state = container_of(p, struct proto_shell_state, teardown_task);
        state->proto.proto_event(&state->proto, IFPEV_DOWN);
-       device_remove_user(&state->l3_dev);
+       if (state->l3_dev.dev)
+               device_remove_user(&state->l3_dev);
 }
 
 static void