Hi and thanx for replying!
Quote:
Originally Posted by pan64
No it does not work in userspace too.
|
This compiles and works just fine though...
Code:
#include <stdlib.h>
void custom_alloc(char **ptr){
*ptr = malloc(128);
}
int main(int argc, char **argv){
char *ptr;
custom_alloc(&ptr);
free(ptr);
return 0;
}
However in Kernel i am getting error even while just passing the pointer without allocating memory, like this`
Code:
int another(char **name){
return 0;
}
static int __init test_init(void){
char *name;
another(&name);
printk(KERN_INFO "Hello!");
return 0;
}
Also it works if i make name static.