Signed-off-by: Julien Desfossez <julien.desfossez@polymtl.ca>
/* Blocking call, waiting for transmission */
sock = lttcomm_accept_unix_sock(client_socket);
if (sock <= 0) {
/* Blocking call, waiting for transmission */
sock = lttcomm_accept_unix_sock(client_socket);
if (sock <= 0) {
- WARN("On accept, retrying");
goto error;
}
while (1) {
goto error;
}
while (1) {
struct ltt_kconsumerd_fd *iter;
int i = 0;
struct ltt_kconsumerd_fd *iter;
int i = 0;
- if (*pollfd != NULL) {
- free(*pollfd);
- *pollfd = NULL;
- }
-
- if (*local_kconsumerd_fd != NULL) {
- free(*local_kconsumerd_fd);
- *local_kconsumerd_fd = NULL;
- }
-
- /* allocate for all fds + 1 for the poll_pipe */
- *pollfd = malloc((fds_count + 1) * sizeof(struct pollfd));
- if (*pollfd == NULL) {
- perror("pollfd malloc");
- goto error_mem;
- }
-
- /* allocate for all fds + 1 for the poll_pipe */
- *local_kconsumerd_fd = malloc((fds_count + 1) * sizeof(struct ltt_kconsumerd_fd));
- if (*local_kconsumerd_fd == NULL) {
- perror("local_kconsumerd_fd malloc");
- goto error_mem;
- }
DBG("Updating poll fd array");
pthread_mutex_lock(&kconsumerd_lock_fds);
DBG("Updating poll fd array");
pthread_mutex_lock(&kconsumerd_lock_fds);
pthread_mutex_unlock(&kconsumerd_lock_fds);
return i;
pthread_mutex_unlock(&kconsumerd_lock_fds);
return i;
-error_mem:
- return -ENOMEM;
* local array as well
*/
if (update_fd_array) {
* local array as well
*/
if (update_fd_array) {
+ if (pollfd != NULL) {
+ free(pollfd);
+ pollfd = NULL;
+ }
+ if (local_kconsumerd_fd != NULL) {
+ free(local_kconsumerd_fd);
+ local_kconsumerd_fd = NULL;
+ }
+ /* allocate for all fds + 1 for the poll_pipe */
+ pollfd = malloc((fds_count + 1) * sizeof(struct pollfd));
+ if (pollfd == NULL) {
+ perror("pollfd malloc");
+ goto end;
+ }
+ /* allocate for all fds + 1 for the poll_pipe */
+ local_kconsumerd_fd = malloc((fds_count + 1) * sizeof(struct ltt_kconsumerd_fd));
+ if (local_kconsumerd_fd == NULL) {
+ perror("local_kconsumerd_fd malloc");
+ goto end;
+ }
+
ret = update_poll_array(&pollfd, local_kconsumerd_fd);
if (ret < 0) {
ERR("Error in allocating pollfd or local_outfds");
ret = update_poll_array(&pollfd, local_kconsumerd_fd);
if (ret < 0) {
ERR("Error in allocating pollfd or local_outfds");