projects
/
userspace-rcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rculfhash: check malloc NULL pointer
[userspace-rcu.git]
/
rculfhash.c
diff --git
a/rculfhash.c
b/rculfhash.c
index b114e0c1e3f5e9afe56e985da2f6122551cc1f4f..1afccfdfc1378ad295cbcbc8f7cec0861b800a9b 100644
(file)
--- a/
rculfhash.c
+++ b/
rculfhash.c
@@
-150,12
+150,14
@@
*/
#define _LGPL_SOURCE
*/
#define _LGPL_SOURCE
+#define _GNU_SOURCE
#include <stdlib.h>
#include <errno.h>
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
+#include <sched.h>
#include "config.h"
#include <urcu.h>
#include "config.h"
#include <urcu.h>
@@
-1553,6
+1555,11
@@
int cds_lfht_del(struct cds_lfht *ht, struct cds_lfht_node *node)
return ret;
}
return ret;
}
+int cds_lfht_is_node_deleted(struct cds_lfht_node *node)
+{
+ return is_removed(rcu_dereference(node->next));
+}
+
static
int cds_lfht_delete_bucket(struct cds_lfht *ht)
{
static
int cds_lfht_delete_bucket(struct cds_lfht *ht)
{
@@
-1775,6
+1782,11
@@
void __cds_lfht_resize_lazy_launch(struct cds_lfht *ht)
return;
}
work = malloc(sizeof(*work));
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);
work->ht = ht;
ht->flavor->update_call_rcu(&work->head, do_resize_cb);
CMM_STORE_SHARED(ht->resize_initiated, 1);
This page took
0.023791 seconds
and
4
git commands to generate.