datasets: remove useless NULL check

Coverity did detect that the cleaning code is only reached with
Dataset *set being initialized so the check is useless.

** CID 1649392:       Null pointer dereferences  (REVERSE_INULL)
/src/datasets-context-json.c: 719           in DatajsonGet()
>>>     Null-checking "set" suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.

** CID 1649391:       Null pointer dereferences  (REVERSE_INULL)
/src/datasets.c: 526           in DatasetGet()
>>>     Null-checking "set" suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
pull/13483/head
Eric Leblond 10 months ago committed by Victor Julien
parent e947c4030c
commit 495a12fad7

@ -716,12 +716,10 @@ Dataset *DatajsonGet(const char *name, enum DatasetTypes type, const char *load,
DatasetUnlock();
return set;
out_err:
if (set) {
if (set->hash) {
THashShutdown(set->hash);
}
SCFree(set);
if (set->hash) {
THashShutdown(set->hash);
}
SCFree(set);
DatasetUnlock();
return NULL;
}

@ -520,12 +520,10 @@ Dataset *DatasetGet(const char *name, enum DatasetTypes type, const char *save,
DatasetUnlock();
return set;
out_err:
if (set) {
if (set->hash) {
THashShutdown(set->hash);
}
SCFree(set);
if (set->hash) {
THashShutdown(set->hash);
}
SCFree(set);
DatasetUnlock();
return NULL;
}

Loading…
Cancel
Save