mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
19 lines
353 B
C
19 lines
353 B
C
/* https://cirosantilli.com/linux-kernel-module-cheat#malloc */
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
char *ptr = NULL;
|
|
size_t size = 1;
|
|
while (1) {
|
|
printf("0x%zx\n", size);
|
|
ptr = realloc(ptr, size);
|
|
if (ptr == NULL) {
|
|
break;
|
|
} else {
|
|
size <<= 1;
|
|
}
|
|
}
|
|
}
|