Possible memory leak fix

This commit is contained in:
root
2024-05-12 14:15:48 +02:00
parent ec5c155ccb
commit 90f44e3a98

View File

@ -301,6 +301,11 @@ int writeListDataInfoToSocket(ftpDataType *ftpData, int clientId, int *filesNumb
returnCode = socketWorkerPrintf(ftpData, clientId, "sds", "total ", fileAndFoldersCount ,"\r\n");
if (returnCode <= 0)
{
for (x = 0; x < fileAndFoldersCount; x++)
DYNMEM_free (fileList[x], memoryTable);
DYNMEM_free (fileList, memoryTable);
return -1;
}
}
@ -346,6 +351,7 @@ int writeListDataInfoToSocket(ftpDataType *ftpData, int clientId, int *filesNumb
if (data.isDirectory == 0 && data.isFile == 0 && data.isLink == 0)
{
DYNMEM_free (fileList[i], memoryTable);
continue;
}
@ -393,7 +399,6 @@ int writeListDataInfoToSocket(ftpDataType *ftpData, int clientId, int *filesNumb
localtime_r(&data.lastModifiedData, &newtime);
strftime(data.lastModifiedDataString, LIST_DATA_TYPE_MODIFIED_DATA_STR_SIZE, "%b %d %Y", &newtime);
switch (commandType)
{
case COMMAND_TYPE_LIST:
@ -495,7 +500,6 @@ int writeListDataInfoToSocket(ftpDataType *ftpData, int clientId, int *filesNumb
DYNMEM_free (fileList, memoryTable);
return -1;
}
}
if (fileList != NULL)