Close file descriptors for socket appropriately during SoftAP disconnect.
Change-Id: Idadae26ce6bbdf1ea6f6b1eaa63cd890bbfcb541 CRs-Fixed: 293934
This commit is contained in:
8
softap/jni/QWiFiSoftApCfg.c
Normal file → Executable file
8
softap/jni/QWiFiSoftApCfg.c
Normal file → Executable file
@@ -313,7 +313,8 @@ JNIEXPORT jstring JNICALL
|
|||||||
const char *pcmd;
|
const char *pcmd;
|
||||||
char cmd[MAX_CMD_SIZE];
|
char cmd[MAX_CMD_SIZE];
|
||||||
char resp[MAX_RESP_SIZE];
|
char resp[MAX_RESP_SIZE];
|
||||||
int sock, rc;
|
int sock = -1;
|
||||||
|
int rc;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
char code[32] = {0};
|
char code[32] = {0};
|
||||||
int connect_retry;
|
int connect_retry;
|
||||||
@@ -400,5 +401,10 @@ JNIEXPORT jstring JNICALL
|
|||||||
end:
|
end:
|
||||||
(*env)->ReleaseStringUTFChars(env, jcmd, pcmd);
|
(*env)->ReleaseStringUTFChars(env, jcmd, pcmd);
|
||||||
|
|
||||||
|
if( sock >= 0 ){
|
||||||
|
close(sock);
|
||||||
|
sock = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return (*env)->NewStringUTF(env, resp);
|
return (*env)->NewStringUTF(env, resp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1132,12 +1132,14 @@ int qsap_get_operating_channel(s32 *pchan)
|
|||||||
ret = ioctl(sock, QCSAP_IOCTL_GET_CHANNEL, &wrq);
|
ret = ioctl(sock, QCSAP_IOCTL_GET_CHANNEL, &wrq);
|
||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
LOGE("%s: ioctl failure \n",__func__);
|
LOGE("%s: ioctl failure \n",__func__);
|
||||||
|
close(sock);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGE("Recv len :%d \n", wrq.u.data.length);
|
LOGE("Recv len :%d \n", wrq.u.data.length);
|
||||||
|
|
||||||
LOGE("Operating channel :%ld \n", *pchan);
|
LOGE("Operating channel :%ld \n", *pchan);
|
||||||
|
close(sock);
|
||||||
return eSUCCESS;
|
return eSUCCESS;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
@@ -1231,6 +1233,7 @@ void qsap_get_associated_sta_mac(s8 *presp, u32 *plen)
|
|||||||
pbuf = (s8 *)malloc((MAX_STA_ALLOWED * 6) + 8);
|
pbuf = (s8 *)malloc((MAX_STA_ALLOWED * 6) + 8);
|
||||||
if(NULL == pbuf) {
|
if(NULL == pbuf) {
|
||||||
LOGE("%s :No memory \n", __func__);
|
LOGE("%s :No memory \n", __func__);
|
||||||
|
close(sock);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1245,6 +1248,7 @@ void qsap_get_associated_sta_mac(s8 *presp, u32 *plen)
|
|||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
LOGE("%s :ioctl failure \n", __func__);
|
LOGE("%s :ioctl failure \n", __func__);
|
||||||
free(pbuf);
|
free(pbuf);
|
||||||
|
close(sock);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1259,6 +1263,7 @@ void qsap_get_associated_sta_mac(s8 *presp, u32 *plen)
|
|||||||
*plen = len + tlen;
|
*plen = len + tlen;
|
||||||
|
|
||||||
free(pbuf);
|
free(pbuf);
|
||||||
|
close(sock);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
@@ -1328,6 +1333,7 @@ void qsap_read_ap_stats(s8 *presp, u32 *plen)
|
|||||||
pbuf = (s8 *)malloc(MAX_RESP_LEN);
|
pbuf = (s8 *)malloc(MAX_RESP_LEN);
|
||||||
if(NULL == pbuf) {
|
if(NULL == pbuf) {
|
||||||
LOGE("%s :No memory \n", __func__);
|
LOGE("%s :No memory \n", __func__);
|
||||||
|
close(sock);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1340,6 +1346,7 @@ void qsap_read_ap_stats(s8 *presp, u32 *plen)
|
|||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
LOGE("%s :ioctl failure \n", __func__);
|
LOGE("%s :ioctl failure \n", __func__);
|
||||||
free(pbuf);
|
free(pbuf);
|
||||||
|
close(sock);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1350,7 +1357,7 @@ void qsap_read_ap_stats(s8 *presp, u32 *plen)
|
|||||||
*plen = recvLen;
|
*plen = recvLen;
|
||||||
|
|
||||||
free(pbuf);
|
free(pbuf);
|
||||||
|
close(sock);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
@@ -2052,6 +2059,7 @@ void qsap_disassociate_sta(s8 *pVal, s8 *presp, u32 *plen)
|
|||||||
|
|
||||||
if(TRUE != qsap_get_mac_in_bytes(pVal, pbuf)) {
|
if(TRUE != qsap_get_mac_in_bytes(pVal, pbuf)) {
|
||||||
LOGE("%s: Invalid input \n", __func__);
|
LOGE("%s: Invalid input \n", __func__);
|
||||||
|
close(sock);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2063,6 +2071,7 @@ void qsap_disassociate_sta(s8 *pVal, s8 *presp, u32 *plen)
|
|||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
LOGE("%s: ioctl failure \n", __func__);
|
LOGE("%s: ioctl failure \n", __func__);
|
||||||
}
|
}
|
||||||
|
close(sock);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
*plen = snprintf(presp, *plen, "%s", (ret == eSUCCESS) ? SUCCESS : ERR_UNKNOWN);
|
*plen = snprintf(presp, *plen, "%s", (ret == eSUCCESS) ? SUCCESS : ERR_UNKNOWN);
|
||||||
|
|||||||
Reference in New Issue
Block a user