Replace variable-length arrays on stack with malloc.

Bug: 30202619
Change-Id: Ib95e08a1c009d88a4b4fd8d8fdba0641c6129008
(cherry picked from commit 943905bb9f99e3caa856b42c531e2be752da8834)

void RilSapSocket::addSocketToList(const char *socketName, RIL_SOCKET_ID socketid,
        RIL_RadioFunctions *uimFuncs) {
 RilSapSocket* socket = NULL;
 RilSapSocketList *current;

 if(!SocketExists(socketName)) {
        socket = new RilSapSocket(socketName, socketid, uimFuncs);
 RilSapSocketList* listItem = (RilSapSocketList*)malloc(sizeof(RilSapSocketList));
 if (!listItem) {
            RLOGE("addSocketToList: OOM");
 return;
 }
        listItem->socket = socket;
        listItem->next = NULL;

        RLOGD("Adding socket with id: %d", socket->id);

 if(NULL == head) {
            head = listItem;
            head->next = NULL;
 }
 else {
            current = head;
 while(NULL != current->next) {
                current = current->next;
 }
            current->next = listItem;
 }
        socket->socketInit();
 }
}

void RilSapSocket::addSocketToList(const char *socketName, RIL_SOCKET_ID socketid,
        RIL_RadioFunctions *uimFuncs) {
 RilSapSocket* socket = NULL;
 RilSapSocketList *current;

 if(!SocketExists(socketName)) {
        socket = new RilSapSocket(socketName, socketid, uimFuncs);
 RilSapSocketList* listItem = (RilSapSocketList*)malloc(sizeof(RilSapSocketList));
 if (!listItem) {
            RLOGE("addSocketToList: OOM");
 return;
 }
        listItem->socket = socket;
        listItem->next = NULL;

        RLOGD("Adding socket with id: %d", socket->id);

 if(NULL == head) {
            head = listItem;
            head->next = NULL;
 }
 else {
            current = head;
 while(NULL != current->next) {
                current = current->next;
 }
            current->next = listItem;
 }
        socket->socketInit();
 }
}
