In following code, is it possible cause some memory leaks?
reference-ril.c
static void requestRadioPower(void *data, size_t datalen, RIL_Token t)
{
....
ATResponse *p_response = NULL;
....
err = at_send_command(cmd, &p_response); // it's a memory leakage or not ?
....
at_response_free(p_response);
....
}
And in other function:
static void requestOrSendPDPContextList(RIL_Token *t)
{
ATResponse *p_response;
....
err = at_send_command_multiline ("AT+CGACT?", "+CGACT:", &p_response);
// it's a leakage or not ?
....
at_response_free(p_response);
....
}
Actually, these function will returned before calling at_response_free(p_response) in some cases. I suppose we shout set ATResponse *p_response to NULL first, right ? Set pointer to NULL is a good idea or not?