diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2014-06-03 10:47:48 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-06-09 12:02:58 +0200 |
commit | 1087eb53144cb34e20f82595187ce70853fe4cd9 (patch) | |
tree | 6c3ffa5d1cdabb732351fe69fecfe6873de715a0 | |
parent | 732c19948da05e4570aa3c7d3a1dd043a52ab83c (diff) | |
download | libnl-1087eb53144cb34e20f82595187ce70853fe4cd9.tar.gz |
obj: Fix dereference before NULL check
The check for !obj indicates that obj might be NULL, thus move the call
to obj_ops(obj) - which dereferences obj - after the check.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | lib/object.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/object.c b/lib/object.c index c3751a6f..405912b5 100644 --- a/lib/object.c +++ b/lib/object.c @@ -110,13 +110,14 @@ struct nl_derived_object { struct nl_object *nl_object_clone(struct nl_object *obj) { struct nl_object *new; - struct nl_object_ops *ops = obj_ops(obj); + struct nl_object_ops *ops; int doff = offsetof(struct nl_derived_object, data); int size; if (!obj) return NULL; + ops = obj_ops(obj); new = nl_object_alloc(ops); if (!new) return NULL; |