rocr: fix nullptr dereference (#262)
* rocr: fix nullptr dereference Return early in the case that malloc fails to avoid dereferencing of a null pointer on eventDescrp. Signed-off-by: Sunday Clement <Sunday.Clement@amd.com> * rocr: Fix potential nullptr dereference returns early if sym->section() fails to properly acquire the object. Signed-off-by: Sunday Clement <Sunday.Clement@amd.com> --------- Signed-off-by: Sunday Clement <Sunday.Clement@amd.com> Co-authored-by: Sunday Clement <Sunday.Clement@amd.com>
Dieser Commit ist enthalten in:
committet von
GitHub
Ursprung
55ca813ded
Commit
bebe65f104
@@ -539,6 +539,8 @@ typedef struct EventDescriptor_ {
|
||||
EventHandle CreateOsEvent(bool auto_reset, bool init_state) {
|
||||
EventDescriptor* eventDescrp;
|
||||
eventDescrp = (EventDescriptor*)malloc(sizeof(EventDescriptor));
|
||||
|
||||
if(!eventDescrp) { return nullptr; }
|
||||
|
||||
pthread_mutex_init(&eventDescrp->mutex, NULL);
|
||||
pthread_cond_init(&eventDescrp->event, NULL);
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren