-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed bugs which caused task_struct memory leak in ptrace.c and kerne…
…l memory leak in hashmap
- Loading branch information
1 parent
a28aa81
commit 8d133e8
Showing
11 changed files
with
121 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
build: | ||
@gcc linked_list_test.c linkedlist.c -o linked_list_test | ||
@gcc hashmap_test.c hashmap.c linkedlist.c -o hmap_test | ||
|
||
clean: | ||
@rm linked_list_test | ||
@rm hmap_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "hashmap.h" | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
|
||
int main (char * argv, int argc) { | ||
hashmap test; | ||
hmap_init(&test, 1000); | ||
int a [100]; | ||
for (int i = 0; i < 100; i++) { | ||
a[i] = i; | ||
hmap_put_abs(&test, i, &a[i]); | ||
} | ||
for (int i = 0; i < 50; i++) { | ||
hmap_put_abs(&test, i, &a[i]); | ||
hmap_remove_abs(&test, i); | ||
} | ||
for (int i = 50; i < 100; i++) { | ||
printf("Hmap get = %d\n", *(int *) hmap_get_abs(&test, i)); | ||
} | ||
|
||
for (int i = 0; i < 50; i++) { | ||
if (hmap_get_abs(&test, i)) | ||
return 0; | ||
} | ||
|
||
hmap_destroy(&test); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "linkedlist.h" | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
|
||
int main (char * argv, int argc) { | ||
llist test_list; | ||
llist_init(&test_list); | ||
int a [100]; | ||
for (int i = 0; i < 100; i++) { | ||
a[i] = i; | ||
llist_append(&test_list, &a[i]); | ||
} | ||
for (int i = 0; i < 50; i++) { | ||
llist_append(&test_list, &a[i]); | ||
llist_pop(&test_list); | ||
} | ||
|
||
for (int i = 0; i < 50; i++) { | ||
llist_requeue(&test_list); | ||
} | ||
|
||
for (int i = 0; i < 50; i++) { | ||
llist_remove_at(&test_list, 0); | ||
} | ||
printf("LList size = %d", llist_size(&test_list)); | ||
llist_destroy(&test_list); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters