Skip to content

Commit

Permalink
Merge pull request #287 from wcohen/wcohen/coverity202411
Browse files Browse the repository at this point in the history
Wcohen/coverity202411
  • Loading branch information
Treece-Burgess authored Nov 21, 2024
2 parents 366ac71 + ed919ac commit 86d1590
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/components/infiniband/linux-infiniband.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ add_ib_counter(const char* name, const char* file_name, int extended, ib_device_
if (new_cnt->ev_name==0 || new_cnt->ev_file_name==0)
{
PAPIERROR("cannot allocate memory for counter internal fields");
/* free(NULL) is allowed and means no operation is performed */
papi_free(new_cnt->ev_name);
papi_free(new_cnt->ev_file_name);
papi_free(new_cnt);
return (0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/lmsensors/linux-lmsensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ link_lmsensors_libraries ()
return PAPI_ENOSUPP;
}

char path_name[1024];
char path_name[PATH_MAX];
char *lmsensors_root = getenv("PAPI_LMSENSORS_ROOT");

dl1 = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/components/sysdetect/linux_cpu_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ get_cache_type( const char *dirname, int *value )
char filename[BUFSIZ];
char type_string[BUFSIZ];
char buffer[BUFSIZ];
int type;
int type = PAPI_MH_TYPE_EMPTY;

sprintf(filename, "/sys/devices/system/cpu/cpu0/cache/%s/type",
dirname);
Expand Down
1 change: 1 addition & 0 deletions src/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ allocate_thread( int tid )
if ( thread->context[i] == NULL ) {
for ( i--; i >= 0; i-- )
papi_free( thread->context[i] );
papi_free( thread->running_eventset );
papi_free( thread->context );
papi_free( thread );
return ( NULL );
Expand Down

0 comments on commit 86d1590

Please sign in to comment.