When sorting the dso array we sometimes get a crash due to null
comparisons in comparator functions. So prevent __dsos__add from
adding null to the dso array to avoid out-of-memory related errors.
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
int __dsos__add(struct dsos *dsos, struct dso *dso)
{
+ if (!dso)
+ return -EINVAL;
+
if (dsos->cnt == dsos->allocated) {
unsigned int to_allocate = 2;
struct dso **temp;