diff --git a/bb_core_posix.c b/bb_core_posix.c index d44e10f..c508c3d 100644 --- a/bb_core_posix.c +++ b/bb_core_posix.c @@ -238,12 +238,11 @@ static int posix_bb_shmem_get(S_BB_T ** bb, return BB_NOK; } - *bb = (S_BB_T *)malloc(sizeof(shm_size)); + *bb = (S_BB_T *)malloc(shm_size); - if (*bb < 0) { + if (*bb == NULL) { LOG(BB_LOG_SEVERE, "BlackBoard::bb_create", "Cannot allow memory "); - *bb = NULL; return BB_NOK; } @@ -272,9 +271,10 @@ static int posix_bb_shmem_get(S_BB_T ** bb, /* else look for the corresponding fd */ for (i_bb = 0; i_bb < bb_count; i_bb++){ - if ( strncmp((char *)bb_used[i_bb].name, name, BB_NAME_MAX_SIZE + 1) == 0) + if ( strncmp((char *)bb_used[i_bb].name, name, BB_NAME_MAX_SIZE + 1) == 0) { *bb = bb_used[i_bb].fd; success = TRUE; + } } if (!success){ diff --git a/bb_core_posix.h b/bb_core_posix.h index 408e40b..6092b5b 100644 --- a/bb_core_posix.h +++ b/bb_core_posix.h @@ -42,7 +42,7 @@ Component : BlackBoard #define MAX_NUM_OF_BB 5 struct bb_used_t { - char *name[BB_NAME_MAX_SIZE+1]; + char name[BB_NAME_MAX_SIZE+1]; S_BB_T *fd; };