diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2016-12-07 12:16:05 +0100 | 
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2016-12-09 17:36:25 +0100 | 
| commit | 3c5070bec0a64918ae87b0992221b8e6c98ff136 (patch) | |
| tree | 5056722639e4fe8361835715436ed17c454382fe /lib/qobj.c | |
| parent | f6eacff4386610eea9fe67ceba7e50f8d87fad4a (diff) | |
lib: make qobj NULL-safe/aware
reserve qobj ID 0 for a NULL pointer.  (No change is needed for lookups
since looking up 0 will simply fail and return NULL.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/qobj.c')
| -rw-r--r-- | lib/qobj.c | 2 | 
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/qobj.c b/lib/qobj.c index f64972e32a..aeae52e029 100644 --- a/lib/qobj.c +++ b/lib/qobj.c @@ -49,7 +49,7 @@ void qobj_reg(struct qobj_node *node, struct qobj_nodetype *type)        node->nid  = (uint64_t)random();        node->nid ^= (uint64_t)random() << 32;      } -  while (hash_get (nodes, node, hash_alloc_intern) != node); +  while (!node->nid || hash_get (nodes, node, hash_alloc_intern) != node);  }  void qobj_unreg(struct qobj_node *node)  | 
