In fact, there was only one "real" leak: An empty info string (100
bytes) could leak on file change.
/* valid command and sufficient perms */
alarm(0);
argc = split_args(command, &argv, "\n");
- mutex_lock(mmd_mutex);
- mmd->num_commands++;
- mutex_unlock(mmd_mutex);
PARA_NOTICE_LOG("calling com_%s() for %s@%s\n", cmd->name, u->name,
peername);
ret = cmd->handler(fd, argc, argv);
+ mutex_lock(mmd_mutex);
+ mmd->num_commands++;
+ free(mmd->afd.afhi.info_string);
+ free(mmd->afd.afhi.chunk_table);
+ mutex_unlock(mmd_mutex);
if (ret >= 0)
goto out;
err_out:
PARA_EMERG_LOG("terminating on signal %d\n", st->signum);
genocide:
kill(0, SIGTERM);
+ free(mmd->afd.afhi.chunk_table);
+ free(mmd->afd.afhi.info_string);
+ close_listed_fds();
mutex_destroy(mmd_mutex);
shm_detach(mmd);
exit(EXIT_FAILURE);
struct stat statbuf;
vsst->afsss = AFS_SOCKET_READY;
- mmd->afd.afhi.chunk_table = NULL;
ret = recv_afs_msg(vsst->afs_socket, &passed_fd, &afs_code, &afs_data);
if (ret < 0)
goto err;
if (passed_fd < 0)
goto err;
shmid = afs_data;
+ free(mmd->afd.afhi.info_string);
ret = load_afd(shmid, &mmd->afd);
if (ret < 0)
goto err;