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>
This commit is contained in:
parent
732c19948d
commit
1087eb5314
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue