@@ -554,7 +554,8 @@ static int qmi_gprs_context_probev(struct ofono_gprs_context *gc,
unsigned int vendor, va_list args)
{
int mux_id = va_arg(args, int);
- struct qmi_service *wds = va_arg(args, struct qmi_service *);
+ _auto_(qmi_service_free) struct qmi_service *wds =
+ va_arg(args, struct qmi_service *);
struct gprs_context_data *data;
DBG("");
@@ -562,14 +563,12 @@ static int qmi_gprs_context_probev(struct ofono_gprs_context *gc,
if (mux_id != -1) {
int r = qmi_gprs_context_bind_mux(gc, wds, mux_id);
- if (r < 0) {
- qmi_service_free(wds);
+ if (r < 0)
return r;
- }
}
data = l_new(struct gprs_context_data, 1);
- data->wds = wds;
+ data->wds = l_steal_ptr(wds);
data->mux_id = mux_id;
qmi_service_register(data->wds, QMI_WDS_PACKET_SERVICE_STATUS,