aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-11-21 16:06:02 (GMT)
committerJouni Malinen <j@w1.fi>2010-01-09 17:47:24 (GMT)
commitab8ed0c8371544ccefebf8dfcc6923c5cf76607c (patch)
tree9fec729894081e8f73ed24a92ce3572ee443037f
parente6e9da3a88481412300b64d16dda5ec4ba6696f1 (diff)
downloadhostap-06-ab8ed0c8371544ccefebf8dfcc6923c5cf76607c.zip
hostap-06-ab8ed0c8371544ccefebf8dfcc6923c5cf76607c.tar.gz
hostap-06-ab8ed0c8371544ccefebf8dfcc6923c5cf76607c.tar.bz2
WPS: Cleanup subscription URL list handling
Do not give the allocated memory to the subscription code since it was not using it as-is anyway. This makes it easier to understand who owns the allocation an is responsible of freeing it. This may potentially fix some memory leaks on error paths. (cherry picked from commit 3f6dc111ff509348a92bff8bbfa2b27f3101315a) Conflicts: src/wps/wps_upnp_web.c
-rw-r--r--src/wps/wps_upnp.c7
-rw-r--r--src/wps/wps_upnp_i.h2
-rw-r--r--src/wps/wps_upnp_web.c2
3 files changed, 5 insertions, 6 deletions
diff --git a/src/wps/wps_upnp.c b/src/wps/wps_upnp.c
index 1caa29b..4c6aac2 100644
--- a/src/wps/wps_upnp.c
+++ b/src/wps/wps_upnp.c
@@ -734,13 +734,13 @@ static int subscription_first_event(struct subscription *s)
/**
- * subscription_start - Rremember a UPnP control point to send events to.
+ * subscription_start - Remember a UPnP control point to send events to.
* @sm: WPS UPnP state machine from upnp_wps_device_init()
- * @callback_urls: malloc' mem given to the subscription
+ * @callback_urls: Callback URLs
* Returns: %NULL on error, or pointer to new subscription structure.
*/
struct subscription * subscription_start(struct upnp_wps_device_sm *sm,
- char *callback_urls)
+ const char *callback_urls)
{
struct subscription *s;
time_t now = time(NULL);
@@ -780,7 +780,6 @@ struct subscription * subscription_start(struct upnp_wps_device_sm *sm,
}
wpa_printf(MSG_DEBUG, "WPS UPnP: Subscription %p started with %s",
s, callback_urls);
- os_free(callback_urls);
/* Schedule sending this */
event_send_all_later(sm);
return s;
diff --git a/src/wps/wps_upnp_i.h b/src/wps/wps_upnp_i.h
index 6a4aa5e..ba4ec20 100644
--- a/src/wps/wps_upnp_i.h
+++ b/src/wps/wps_upnp_i.h
@@ -160,7 +160,7 @@ struct upnp_wps_device_sm {
/* wps_upnp.c */
void format_date(struct wpabuf *buf);
struct subscription * subscription_start(struct upnp_wps_device_sm *sm,
- char *callback_urls);
+ const char *callback_urls);
struct subscription * subscription_renew(struct upnp_wps_device_sm *sm,
const u8 uuid[UUID_LEN]);
void subscription_unlink(struct subscription *s);
diff --git a/src/wps/wps_upnp_web.c b/src/wps/wps_upnp_web.c
index db47c29..b637454 100644
--- a/src/wps/wps_upnp_web.c
+++ b/src/wps/wps_upnp_web.c
@@ -1578,7 +1578,6 @@ static void web_connection_parse_subscribe(struct web_connection *c,
ret = HTTP_INTERNAL_SERVER_ERROR;
goto error;
}
- callback_urls = NULL; /* is now owned by subscription */
} else {
ret = HTTP_PRECONDITION_FAILED;
goto error;
@@ -1630,6 +1629,7 @@ error:
http_put_empty(buf, ret);
send_wpabuf(c->sd, buf);
wpabuf_free(buf);
+ os_free(callback_urls);
}