Skip to content

Commit

Permalink
Fix NULL dereference in ppc32_get_idling_pc.
Browse files Browse the repository at this point in the history
Fixes #115
  • Loading branch information
flaviojs committed Apr 3, 2024
1 parent e8c4e38 commit 47041af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stable/ppc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ int ppc32_get_idling_pc(cpu_gen_t *cpu)
printf("\nPlease wait while gathering statistics...\n");

pc_hash = calloc(IDLE_HASH_SIZE,sizeof(struct ppc32_idle_pc_hash *));
if (pc_hash == NULL) {
printf("Out of memory.");
return(-1);
}

/* Disable IRQ */
pcpu->irq_disable = TRUE;
Expand Down
4 changes: 4 additions & 0 deletions unstable/ppc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ int ppc32_get_idling_pc(cpu_gen_t *cpu)
printf("\nPlease wait while gathering statistics...\n");

pc_hash = calloc(IDLE_HASH_SIZE,sizeof(struct ppc32_idle_pc_hash *));
if (pc_hash == NULL) {
printf("Out of memory.");
return(-1);
}

/* Disable IRQ */
pcpu->irq_disable = TRUE;
Expand Down

0 comments on commit 47041af

Please sign in to comment.