Skip to content

Commit

Permalink
pdb: convert to memory logging helper, properly free memory in error …
Browse files Browse the repository at this point in the history
…cases
  • Loading branch information
pantelisk98 authored and henningw committed Mar 29, 2023
1 parent 3d60451 commit ab17b68
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/modules/pdb/pdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ static int add_server(char *host, char *port)
server->host = pkg_malloc(strlen(host)+1);
if (server->host == NULL) {
PKG_MEM_ERROR;
pkg_free(server);
return -1;
}
strcpy(server->host, host);
Expand Down Expand Up @@ -798,9 +799,14 @@ static int mod_init(void)
return -1;
}

global_id = (uint16_t*)shm_malloc(sizeof(uint16_t));

return 0;
global_id = (uint16_t*)shm_malloc(sizeof(uint16_t));
if(!global_id)
{
SHM_MEM_ERROR;
shm_free(active);
return -1;
}
return 0;
}

static int child_init (int rank)
Expand Down

0 comments on commit ab17b68

Please sign in to comment.