Hi Simon, > static void hfp_card_connect(struct ofono_handsfree_card *card, > ofono_handsfree_card_connect_cb_t cb, > void *data) > { > + int err; > + struct ofono_emulator *em = ofono_handsfree_card_get_data(card); > + struct cb_data *cbd; > + > DBG(""); > - ofono_handsfree_card_connect_sco(card); > + > + cbd = cb_data_new(cb, data); > + > + /* > + * The emulator core will take care if the remote side supports > + * codec negotiation or not. > + */ > + err = ofono_emulator_start_codec_negotiation(em, 0, > + codec_negotiation_done_cb, cbd); In the case of HF not supporting codec negotiation, you leak cbd here... > + if (err < 0) { > + CALLBACK_WITH_FAILURE(cb, data); > + > + g_free(cbd); > + return; > + } > + > + /* > + * We hand over to the emulator core here to establish the > + * SCO connection once the codec is negotiated > + * */ > } > Regards, -Denis