X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Ffdpass%2F_info;h=0b10e8a8bbf489bb2ddcf6223d27ece866240610;hb=HEAD;hp=406b2f5c2a7b53757043ca8ecc160bc259b9c6ac;hpb=05b15e51d1312f0b2970061b6497325d43f2be02;p=ccan diff --git a/ccan/io/fdpass/_info b/ccan/io/fdpass/_info index 406b2f5c..0b10e8a8 100644 --- a/ccan/io/fdpass/_info +++ b/ccan/io/fdpass/_info @@ -32,12 +32,20 @@ * read_more, buf); * } * + * // Clean up allocation so -fsanitize=address doesn't see leak! + * static void free_buf(struct io_conn *c, struct buf *buf) + * { + * free(buf); + * } + * * // Child has received fd, start reading loop. * static struct io_plan *got_infd(struct io_conn *conn, int *infd) * { * struct buf *buf = calloc(1, sizeof(*buf)); + * struct io_conn *new_conn; * - * io_new_conn(NULL, *infd, read_more, buf); + * new_conn = io_new_conn(NULL, *infd, read_more, buf); + * io_set_finish(new_conn, free_buf, buf); * return io_close(conn); * } * // Child is receiving the fd to read into. @@ -58,7 +66,7 @@ * * static struct io_plan *send_stdin(struct io_conn *conn, void *unused) * { - * return io_send_fd(conn, STDIN_FILENO, io_close_cb, NULL); + * return io_send_fd(conn, STDIN_FILENO, false, io_close_cb, NULL); * } * * static void parent(int sockfd)