Add missing error handling
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 23 Aug 2011 20:12:06 +0000 (16:12 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 23 Aug 2011 20:12:06 +0000 (16:12 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
libringbuffer/ring_buffer_backend.c
libringbuffer/shm.c
libust/ltt-ring-buffer-client.h

index 816c99cb2b3a2b4c9af29886c4e0322744aec936..cac746c246109d792432ad552e51cc77dd916356 100644 (file)
@@ -278,6 +278,8 @@ int channel_backend_init(struct channel_backend *chanb,
                        struct shm_object *shmobj;
 
                        shmobj = shm_object_table_append(handle->table, shmsize);
+                       if (!shmobj)
+                               goto end;
                        align_shm(shmobj, __alignof__(struct lib_ring_buffer));
                        set_shmp(chanb->buf[i].shmp, zalloc_shm(shmobj, sizeof(struct lib_ring_buffer)));
                        buf = shmp(handle, chanb->buf[i].shmp);
@@ -294,6 +296,8 @@ int channel_backend_init(struct channel_backend *chanb,
                struct lib_ring_buffer *buf;
 
                shmobj = shm_object_table_append(handle->table, shmsize);
+               if (!shmobj)
+                       goto end;
                align_shm(shmobj, __alignof__(struct lib_ring_buffer));
                set_shmp(chanb->buf[0].shmp, zalloc_shm(shmobj, sizeof(struct lib_ring_buffer)));
                buf = shmp(handle, chanb->buf[0].shmp);
index e1dd56f91d0b06afb293a9d8bd601fc158e72845..873e6e87597311ae9a5cc03c3d1c27a53dae025c 100644 (file)
@@ -120,7 +120,6 @@ error_fcntl:
                }
        }
 error_pipe:
-       free(obj);
        return NULL;
        
 }
index 697324c799b7ea03a67a05efcb087f48518d7c86..b3e6f007115ef99a58f30e5f09463c3549a6836e 100644 (file)
@@ -381,6 +381,8 @@ struct ltt_channel *_channel_create(const char *name,
        ltt_chan->handle = channel_create(&client_config, name, ltt_chan, buf_addr,
                              subbuf_size, num_subbuf, switch_timer_interval,
                              read_timer_interval);
+       if (!ltt_chan->handle)
+               return NULL;
        ltt_chan->chan = shmp(ltt_chan->handle, ltt_chan->handle->chan);
        return ltt_chan;
 }
This page took 0.027268 seconds and 4 git commands to generate.