CID
1021247 (#1 of 1): Dereference null return value (NULL_RETURNS)3.
dereference: Dereferencing a null pointer "pl".
Handle more gracefully add_callsite memory allocation failure too.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
hash = jhash(name, name_len, 0);
head = &callsite_table[hash & (CALLSITE_TABLE_SIZE - 1)];
e = zmalloc(sizeof(struct callsite_entry));
hash = jhash(name, name_len, 0);
head = &callsite_table[hash & (CALLSITE_TABLE_SIZE - 1)];
e = zmalloc(sizeof(struct callsite_entry));
+ if (!e) {
+ PERROR("Unable to add callsite for tracepoint \"%s\"", name);
+ return;
+ }
cds_hlist_add_head(&e->hlist, head);
e->tp = tp;
cds_list_add(&e->node, &lib->callsites);
cds_hlist_add_head(&e->hlist, head);
e->tp = tp;
cds_list_add(&e->node, &lib->callsites);
init_tracepoint();
pl = (struct tracepoint_lib *) zmalloc(sizeof(struct tracepoint_lib));
init_tracepoint();
pl = (struct tracepoint_lib *) zmalloc(sizeof(struct tracepoint_lib));
+ if (!pl) {
+ PERROR("Unable to register tracepoint lib");
+ return -1;
+ }
pl->tracepoints_start = tracepoints_start;
pl->tracepoints_count = tracepoints_count;
CDS_INIT_LIST_HEAD(&pl->callsites);
pl->tracepoints_start = tracepoints_start;
pl->tracepoints_count = tracepoints_count;
CDS_INIT_LIST_HEAD(&pl->callsites);