ubusd: fix a use after free bug

This commit is contained in:
Felix Fietkau 2011-09-14 17:09:19 +02:00
parent 7c59d4069c
commit f86ec180c0

View file

@ -207,6 +207,7 @@ static int ubusd_handle_lookup(struct ubus_client *cl, struct ubus_msg_buf *ub,
static int ubusd_handle_invoke(struct ubus_client *cl, struct ubus_msg_buf *ub, struct blob_attr **attr) static int ubusd_handle_invoke(struct ubus_client *cl, struct ubus_msg_buf *ub, struct blob_attr **attr)
{ {
struct ubus_msg_buf *ub_new;
struct ubus_object *obj = NULL; struct ubus_object *obj = NULL;
struct ubus_id *id; struct ubus_id *id;
const char *method; const char *method;
@ -232,9 +233,10 @@ static int ubusd_handle_invoke(struct ubus_client *cl, struct ubus_msg_buf *ub,
blob_put(&b, UBUS_ATTR_DATA, blob_data(attr[UBUS_ATTR_DATA]), blob_put(&b, UBUS_ATTR_DATA, blob_data(attr[UBUS_ATTR_DATA]),
blob_len(attr[UBUS_ATTR_DATA])); blob_len(attr[UBUS_ATTR_DATA]));
ub_new = ubus_reply_from_blob(ub, true);
ubus_msg_free(ub); ubus_msg_free(ub);
ub = ub_new;
ub = ubus_reply_from_blob(ub, true);
if (!ub) if (!ub)
return UBUS_STATUS_NO_DATA; return UBUS_STATUS_NO_DATA;