From: Mathieu Desnoyers Date: Mon, 2 Apr 2012 18:35:34 +0000 (-0400) Subject: rculfhash: check malloc NULL pointer X-Git-Tag: v0.7.0~35 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=741f378eb59c3fdb56566201637446fabfcf7801;p=userspace-rcu.git rculfhash: check malloc NULL pointer Signed-off-by: Mathieu Desnoyers --- diff --git a/rculfhash.c b/rculfhash.c index b90a07a..1afccfd 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -1782,6 +1782,11 @@ void __cds_lfht_resize_lazy_launch(struct cds_lfht *ht) return; } work = malloc(sizeof(*work)); + if (work == NULL) { + dbg_printf("error allocating resize work, bailing out\n"); + uatomic_dec(&ht->in_progress_resize); + return; + } work->ht = ht; ht->flavor->update_call_rcu(&work->head, do_resize_cb); CMM_STORE_SHARED(ht->resize_initiated, 1);