mirror of
https://salsa.debian.org/ha-team/libqb
synced 2026-08-18 18:40:42 +00:00
add FIXME comments for other NULL-deref-upon-OOM problems
* lib/ipc_us.c (handle_new_connection): * lib/loop_job.c (qb_loop_jobs_create): * lib/loop_poll.c (qb_loop_poll_create): * lib/loop_timerlist.c (qb_loop_timer_create): * lib/ringbuffer.c (qb_rb_open): * lib/ipcc.c (qb_ipcc_connect): Likewise. Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
4020c4cea8
commit
9c467cb150
@ -546,6 +546,7 @@ static int32_t handle_new_connection(struct qb_ipcs_service *s,
|
||||
|
||||
qb_list_add(&c->list, &s->connections);
|
||||
c->receive_buf = malloc(c->request.max_msg_size);
|
||||
/* FIXME: c->receive_buf may be NULL, then dereferenced */
|
||||
|
||||
if (s->needs_sock_for_poll) {
|
||||
qb_ipcs_connection_ref(c);
|
||||
|
||||
@ -48,6 +48,7 @@ qb_ipcc_connection_t *qb_ipcc_connect(const char *name, size_t max_msg_size)
|
||||
c->request.max_msg_size = response.max_msg_size;
|
||||
c->event.max_msg_size = response.max_msg_size;
|
||||
c->receive_buf = malloc(response.max_msg_size);
|
||||
/* FIXME: handle NULL return */
|
||||
|
||||
switch (c->type) {
|
||||
case QB_IPC_SHM:
|
||||
|
||||
@ -39,6 +39,7 @@ qb_ipcs_service_t* qb_ipcs_create(const char *name,
|
||||
struct qb_ipcs_service *s;
|
||||
|
||||
s = calloc(1, sizeof(struct qb_ipcs_service));
|
||||
/* FIXME: handle NULL return */
|
||||
|
||||
s->pid = getpid();
|
||||
s->type = type;
|
||||
@ -371,6 +372,7 @@ int32_t qb_ipcs_service_id_get(struct qb_ipcs_connection *c)
|
||||
struct qb_ipcs_connection *qb_ipcs_connection_alloc(struct qb_ipcs_service *s)
|
||||
{
|
||||
struct qb_ipcs_connection *c = calloc(1, sizeof(struct qb_ipcs_connection));
|
||||
/* FIXME: handle NULL return */
|
||||
|
||||
c->refcount = 1;
|
||||
c->service = s;
|
||||
|
||||
@ -229,6 +229,7 @@ void qb_log_callsites_register(struct qb_log_callsite *_start, struct qb_log_cal
|
||||
}
|
||||
|
||||
sect = calloc(1, sizeof(struct callsite_section));
|
||||
/* FIXME: handle NULL return */
|
||||
sect->start = _start;
|
||||
sect->stop = _stop;
|
||||
qb_list_init(§->list);
|
||||
@ -321,10 +322,12 @@ static int32_t _log_filter_store(uint32_t t, enum qb_log_filter_conf c,
|
||||
return -EEXIST;
|
||||
}
|
||||
flt = calloc(1, sizeof(struct qb_log_filter));
|
||||
/* FIXME: handle NULL return */
|
||||
qb_list_init(&flt->list);
|
||||
flt->conf = c;
|
||||
flt->type = type;
|
||||
flt->text = strdup(text);
|
||||
/* FIXME: handle NULL return */
|
||||
flt->priority = priority;
|
||||
flt->new_value = t;
|
||||
qb_list_add_tail(&flt->list, list_head);
|
||||
|
||||
@ -61,6 +61,7 @@ struct qb_loop_source *
|
||||
qb_loop_jobs_create(struct qb_loop *l)
|
||||
{
|
||||
struct qb_loop_source *s = malloc(sizeof(struct qb_loop_source));
|
||||
/* FIXME: handle NULL return */
|
||||
s->l = l;
|
||||
s->dispatch_and_take_back = job_dispatch;
|
||||
s->poll = get_more_jobs;
|
||||
|
||||
@ -381,6 +381,7 @@ struct qb_loop_source*
|
||||
qb_loop_poll_create(struct qb_loop *l)
|
||||
{
|
||||
struct qb_poll_source *s = malloc(sizeof(struct qb_poll_source));
|
||||
/* FIXME: handle NULL return */
|
||||
s->s.l = l;
|
||||
s->s.dispatch_and_take_back = _poll_dispatch_and_take_back_;
|
||||
s->s.poll = _poll_and_add_to_jobs_;
|
||||
|
||||
@ -91,6 +91,7 @@ struct qb_loop_source*
|
||||
qb_loop_timer_create(struct qb_loop *l)
|
||||
{
|
||||
struct qb_timer_source * my_src = malloc(sizeof(struct qb_timer_source));
|
||||
/* FIXME: handle NULL return */
|
||||
my_src->s.l = l;
|
||||
my_src->s.dispatch_and_take_back = timer_dispatch;
|
||||
my_src->s.poll = expire_the_timers;
|
||||
|
||||
@ -84,6 +84,7 @@ qb_ringbuffer_t *qb_rb_open(const char *name, size_t size, uint32_t flags,
|
||||
size_t shared_user_data_size)
|
||||
{
|
||||
struct qb_ringbuffer_s *rb = malloc(sizeof(struct qb_ringbuffer_s));
|
||||
/* FIXME: handle NULL return */
|
||||
size_t real_size = QB_ROUNDUP(size, sysconf(_SC_PAGESIZE));
|
||||
char path[PATH_MAX];
|
||||
int32_t fd_hdr;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user