diff --git a/examples/upnp_test.cpp b/examples/upnp_test.cpp index 8401b2d12..fce1aa056 100644 --- a/examples/upnp_test.cpp +++ b/examples/upnp_test.cpp @@ -61,18 +61,18 @@ int main(int argc, char* argv[]) return 1; } - session* s = new session; - s->set_alert_mask(alert::port_mapping_notification); + session s; + s.set_alert_mask(alert::port_mapping_notification); for (;;) { - alert const* a = s->wait_for_alert(seconds(5)); + alert const* a = s.wait_for_alert(seconds(5)); if (a == 0) { - s->stop_upnp(); + s.stop_upnp(); break; } - std::auto_ptr holder = s->pop_alert(); + std::auto_ptr holder = s.pop_alert(); print_alert(holder.get()); } @@ -80,14 +80,12 @@ int main(int argc, char* argv[]) for (;;) { - alert const* a = s->wait_for_alert(seconds(5)); + alert const* a = s.wait_for_alert(seconds(5)); if (a == 0) break; - std::auto_ptr holder = s->pop_alert(); + std::auto_ptr holder = s.pop_alert(); print_alert(holder.get()); } - delete s; - s = 0; return 0; }