forked from Imagelibrary/rtems
ftpd: Avoid NULL pointer checks before free()
They are superfluous and just bloat the code. Update #3530.
This commit is contained in:
@@ -373,10 +373,8 @@ task_pool_done(int count)
|
|||||||
int i;
|
int i;
|
||||||
for(i = 0; i < count; ++i)
|
for(i = 0; i < count; ++i)
|
||||||
rtems_task_delete(task_pool.info[i].tid);
|
rtems_task_delete(task_pool.info[i].tid);
|
||||||
if(task_pool.info)
|
free(task_pool.info);
|
||||||
free(task_pool.info);
|
free(task_pool.queue);
|
||||||
if(task_pool.queue)
|
|
||||||
free(task_pool.queue);
|
|
||||||
rtems_mutex_destroy(&task_pool.mutex);
|
rtems_mutex_destroy(&task_pool.mutex);
|
||||||
rtems_counting_semaphore_destroy(&task_pool.sem);
|
rtems_counting_semaphore_destroy(&task_pool.sem);
|
||||||
task_pool.info = 0;
|
task_pool.info = 0;
|
||||||
@@ -1740,10 +1738,8 @@ exec_command(FTPD_SessionInfo_t *info, char* cmd, char* args)
|
|||||||
else if (!strcmp("USER", cmd))
|
else if (!strcmp("USER", cmd))
|
||||||
{
|
{
|
||||||
sscanf(args, "%254s", fname);
|
sscanf(args, "%254s", fname);
|
||||||
if (info->user)
|
free(info->user);
|
||||||
free(info->user);
|
free(info->pass);
|
||||||
if (info->pass)
|
|
||||||
free(info->pass);
|
|
||||||
info->pass = NULL;
|
info->pass = NULL;
|
||||||
info->user = strdup(fname);
|
info->user = strdup(fname);
|
||||||
if (ftpd_config->login &&
|
if (ftpd_config->login &&
|
||||||
@@ -1758,8 +1754,7 @@ exec_command(FTPD_SessionInfo_t *info, char* cmd, char* args)
|
|||||||
else if (!strcmp("PASS", cmd))
|
else if (!strcmp("PASS", cmd))
|
||||||
{
|
{
|
||||||
sscanf(args, "%254s", fname);
|
sscanf(args, "%254s", fname);
|
||||||
if (info->pass)
|
free(info->pass);
|
||||||
free(info->pass);
|
|
||||||
info->pass = strdup(fname);
|
info->pass = strdup(fname);
|
||||||
if (!info->user) {
|
if (!info->user) {
|
||||||
send_reply(info, 332, "Need account to log in");
|
send_reply(info, 332, "Need account to log in");
|
||||||
|
|||||||
Reference in New Issue
Block a user