Change malloc to zmalloc in lttng-sessiond code
authorDavid Goulet <david.goulet@polymtl.ca>
Tue, 15 Nov 2011 20:39:37 +0000 (15:39 -0500)
committerDavid Goulet <david.goulet@polymtl.ca>
Tue, 15 Nov 2011 20:40:48 +0000 (15:40 -0500)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
lttng-sessiond/channel.c
lttng-sessiond/compat/compat-epoll.c
lttng-sessiond/compat/compat-poll.c
lttng-sessiond/kernel-ctl.c
lttng-sessiond/main.c
lttng-sessiond/session.c
lttng-sessiond/trace-kernel.c
lttng-sessiond/trace-ust.c

index 14fdfdcae0050038ab6ad26fd14fe991425eaa1e..2dd9840d4083e864230d87235eb9e01752f4cc68 100644 (file)
@@ -37,7 +37,7 @@ struct lttng_channel *channel_new_default_attr(int dom)
 
        chan = zmalloc(sizeof(struct lttng_channel));
        if (chan == NULL) {
-               perror("malloc channel init");
+               perror("zmalloc channel init");
                goto error_alloc;
        }
 
@@ -88,9 +88,9 @@ int channel_ust_copy(struct ltt_ust_channel *dst,
 
        /*
        cds_list_for_each_entry(uevent, &src->events.head, list) {
-               new_uevent = malloc(sizeof(struct ltt_ust_event));
+               new_uevent = zmalloc(sizeof(struct ltt_ust_event));
                if (new_uevent == NULL) {
-                       perror("malloc ltt_ust_event");
+                       perror("zmalloc ltt_ust_event");
                        goto error;
                }
 
index e909b603c6bdb75fd47869548c9e1d70ec8696e3..aca80f331c74d44c0018b9c3333c2f9a623c24e7 100644 (file)
@@ -57,7 +57,7 @@ int compat_epoll_create(struct lttng_poll_event *events, int size, int flags)
        /* This *must* be freed by using lttng_poll_free() */
        events->events = zmalloc(size * sizeof(struct epoll_event));
        if (events->events == NULL) {
-               perror("malloc epoll set");
+               perror("zmalloc epoll set");
                goto error_close;
        }
 
index cc4bb0f97585df5bcc71b8fb9c1fde43016518c7..50ef37472dc0a94db9eec258f21ce632f7d615d3 100644 (file)
@@ -43,7 +43,7 @@ int compat_poll_create(struct lttng_poll_event *events, int size)
        /* This *must* be freed by using lttng_poll_free() */
        events->events = zmalloc(size * sizeof(struct pollfd));
        if (events->events == NULL) {
-               perror("malloc struct pollfd");
+               perror("zmalloc struct pollfd");
                goto error;
        }
 
@@ -117,7 +117,7 @@ int compat_poll_del(struct lttng_poll_event *events, int fd)
 
        new = zmalloc(new_size * sizeof(struct pollfd));
        if (new == NULL) {
-               perror("malloc poll del");
+               perror("zmalloc poll del");
                goto error;
        }
 
index 203c01050e82199f34128d09b9c5dd95ca6fb0a4..52d60f00460ed01660c1578f3060d84eceb28220 100644 (file)
@@ -49,9 +49,9 @@ int kernel_add_channel_context(struct ltt_kernel_channel *chan,
                goto error;
        }
 
-       chan->ctx = malloc(sizeof(struct lttng_kernel_context));
+       chan->ctx = zmalloc(sizeof(struct lttng_kernel_context));
        if (chan->ctx == NULL) {
-               perror("malloc event context");
+               perror("zmalloc event context");
                goto error;
        }
 
@@ -78,9 +78,9 @@ int kernel_add_event_context(struct ltt_kernel_event *event,
                goto error;
        }
 
-       event->ctx = malloc(sizeof(struct lttng_kernel_context));
+       event->ctx = zmalloc(sizeof(struct lttng_kernel_context));
        if (event->ctx == NULL) {
-               perror("malloc event context");
+               perror("zmalloc event context");
                goto error;
        }
 
@@ -574,7 +574,7 @@ ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
         * See kernel-ctl.h for explanation of this value
         */
        nbmem = KERNEL_EVENT_LIST_SIZE;
-       elist = malloc(sizeof(struct lttng_event) * nbmem);
+       elist = zmalloc(sizeof(struct lttng_event) * nbmem);
 
        while ((size = fscanf(fp, "event { name = %m[^;]; };%n\n", &event, &pos)) == 1) {
                if (count > nbmem) {
index aae9b3dfe6f5f1f7ea2516873ee5f778aca2be27..0c93395b4a573ddbbaeca68332692e5169d777d2 100644 (file)
@@ -588,9 +588,9 @@ static int setup_lttng_msg(struct command_ctx *cmd_ctx, size_t size)
 
        buf_size = size;
 
-       cmd_ctx->llm = malloc(sizeof(struct lttcomm_lttng_msg) + buf_size);
+       cmd_ctx->llm = zmalloc(sizeof(struct lttcomm_lttng_msg) + buf_size);
        if (cmd_ctx->llm == NULL) {
-               perror("malloc");
+               perror("zmalloc");
                ret = -ENOMEM;
                goto error;
        }
@@ -1260,9 +1260,9 @@ static void *thread_registration_apps(void *data)
                                        }
 
                                        /* Create UST registration command for enqueuing */
-                                       ust_cmd = malloc(sizeof(struct ust_command));
+                                       ust_cmd = zmalloc(sizeof(struct ust_command));
                                        if (ust_cmd == NULL) {
-                                               perror("ust command malloc");
+                                               perror("ust command zmalloc");
                                                goto error;
                                        }
 
@@ -3344,16 +3344,16 @@ static void *thread_manage_clients(void *data)
                }
 
                /* Allocate context command to process the client request */
-               cmd_ctx = malloc(sizeof(struct command_ctx));
+               cmd_ctx = zmalloc(sizeof(struct command_ctx));
                if (cmd_ctx == NULL) {
-                       perror("malloc cmd_ctx");
+                       perror("zmalloc cmd_ctx");
                        goto error;
                }
 
                /* Allocate data buffer for reception */
-               cmd_ctx->lsm = malloc(sizeof(struct lttcomm_session_msg));
+               cmd_ctx->lsm = zmalloc(sizeof(struct lttcomm_session_msg));
                if (cmd_ctx->lsm == NULL) {
-                       perror("malloc cmd_ctx->lsm");
+                       perror("zmalloc cmd_ctx->lsm");
                        goto error;
                }
 
@@ -3390,7 +3390,7 @@ static void *thread_manage_clients(void *data)
                if (ret < 0) {
                        /*
                         * TODO: Inform client somehow of the fatal error. At
-                        * this point, ret < 0 means that a malloc failed
+                        * this point, ret < 0 means that a zmalloc failed
                         * (ENOMEM). Error detected but still accept command.
                         */
                        clean_command_ctx(&cmd_ctx);
index c7ce843d71669f3b40609293341dbf8f665a73a1..2ab49485f738a9d3c45df96ba91baed4a397794b 100644 (file)
@@ -175,9 +175,9 @@ int session_create(char *name, char *path)
        }
 
        /* Allocate session data structure */
-       new_session = malloc(sizeof(struct ltt_session));
+       new_session = zmalloc(sizeof(struct ltt_session));
        if (new_session == NULL) {
-               perror("malloc");
+               perror("zmalloc");
                ret = LTTCOMM_FATAL;
                goto error_malloc;
        }
index fa3ba692c828669e3d1edfa37a9645074602437a..c5b81f1e0d6b43138046d3e6cbde5bb7643e36fb 100644 (file)
@@ -88,9 +88,9 @@ struct ltt_kernel_session *trace_kernel_create_session(char *path)
        struct ltt_kernel_session *lks;
 
        /* Allocate a new ltt kernel session */
-       lks = malloc(sizeof(struct ltt_kernel_session));
+       lks = zmalloc(sizeof(struct ltt_kernel_session));
        if (lks == NULL) {
-               perror("create kernel session malloc");
+               perror("create kernel session zmalloc");
                goto error;
        }
 
@@ -126,15 +126,15 @@ struct ltt_kernel_channel *trace_kernel_create_channel(struct lttng_channel *cha
        int ret;
        struct ltt_kernel_channel *lkc;
 
-       lkc = malloc(sizeof(struct ltt_kernel_channel));
+       lkc = zmalloc(sizeof(struct ltt_kernel_channel));
        if (lkc == NULL) {
-               perror("ltt_kernel_channel malloc");
+               perror("ltt_kernel_channel zmalloc");
                goto error;
        }
 
-       lkc->channel = malloc(sizeof(struct lttng_channel));
+       lkc->channel = zmalloc(sizeof(struct lttng_channel));
        if (lkc->channel == NULL) {
-               perror("lttng_channel malloc");
+               perror("lttng_channel zmalloc");
                goto error;
        }
        memcpy(lkc->channel, chan, sizeof(struct lttng_channel));
@@ -170,10 +170,10 @@ struct ltt_kernel_event *trace_kernel_create_event(struct lttng_event *ev)
        struct ltt_kernel_event *lke;
        struct lttng_kernel_event *attr;
 
-       lke = malloc(sizeof(struct ltt_kernel_event));
-       attr = malloc(sizeof(struct lttng_kernel_event));
+       lke = zmalloc(sizeof(struct ltt_kernel_event));
+       attr = zmalloc(sizeof(struct lttng_kernel_event));
        if (lke == NULL || attr == NULL) {
-               perror("kernel event malloc");
+               perror("kernel event zmalloc");
                goto error;
        }
 
@@ -242,10 +242,10 @@ struct ltt_kernel_metadata *trace_kernel_create_metadata(char *path)
        struct ltt_kernel_metadata *lkm;
        struct lttng_channel *chan;
 
-       lkm = malloc(sizeof(struct ltt_kernel_metadata));
-       chan = malloc(sizeof(struct lttng_channel));
+       lkm = zmalloc(sizeof(struct ltt_kernel_metadata));
+       chan = zmalloc(sizeof(struct lttng_channel));
        if (lkm == NULL || chan == NULL) {
-               perror("kernel metadata malloc");
+               perror("kernel metadata zmalloc");
                goto error;
        }
 
@@ -283,9 +283,9 @@ struct ltt_kernel_stream *trace_kernel_create_stream(void)
 {
        struct ltt_kernel_stream *lks;
 
-       lks = malloc(sizeof(struct ltt_kernel_stream));
+       lks = zmalloc(sizeof(struct ltt_kernel_stream));
        if (lks == NULL) {
-               perror("kernel stream malloc");
+               perror("kernel stream zmalloc");
                goto error;
        }
 
index a0d3b1b4165fc26fa87149db9f8a1bf3075a7613..4df481c12e28d4ccecdbede01c65d01779674db2 100644 (file)
@@ -91,9 +91,9 @@ struct ltt_ust_session *trace_ust_create_session(char *path, unsigned int uid,
        struct ltt_ust_session *lus;
 
        /* Allocate a new ltt ust session */
-       lus = malloc(sizeof(struct ltt_ust_session));
+       lus = zmalloc(sizeof(struct ltt_ust_session));
        if (lus == NULL) {
-               PERROR("create ust session malloc");
+               PERROR("create ust session zmalloc");
                goto error;
        }
 
@@ -139,7 +139,7 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan,
 
        luc = zmalloc(sizeof(struct ltt_ust_channel));
        if (luc == NULL) {
-               perror("ltt_ust_channel malloc");
+               perror("ltt_ust_channel zmalloc");
                goto error;
        }
 
@@ -196,7 +196,7 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev)
 
        lue = zmalloc(sizeof(struct ltt_ust_event));
        if (lue == NULL) {
-               PERROR("ust event malloc");
+               PERROR("ust event zmalloc");
                goto error;
        }
 
@@ -250,7 +250,7 @@ struct ltt_ust_metadata *trace_ust_create_metadata(char *path)
 
        lum = zmalloc(sizeof(struct ltt_ust_metadata));
        if (lum == NULL) {
-               perror("ust metadata malloc");
+               perror("ust metadata zmalloc");
                goto error;
        }
 
This page took 0.0345 seconds and 4 git commands to generate.