There are so many things wrong with this code that it's hard to begin anywhere.
So instead, you should just explain what on earth you're trying to do and we can show you an acceptable solution.
Edit: even after your edit, the code is still not obvious. Don't use meaningless variable names like z, x or a, don't use static or global variables unless necessary, avoid recursion unless it's hard to do it with iteration, don't use malloc, free or printf in C++ code.
i made it for quine mccluskey algorithm
i've been search on internet for c code
but i just found in c++ code
for now, i just know c language..
then, i tried to made it by myself
thx for your attention ^^
If this is a C program, you should ask on a C forum. There people probably won't cry out in outrage when seeing such code.
In any case, you're freeing buff twice (for x=1 and x=0).
Sorry but i confused what minterm is meant to do exactly. Could you post an explanation of just that function and why you have a problem freeing the buf variable. I mean, i can't immediately see anything syntactically wrong with that line but won't be able to find any logic issues if i don't know what it's meant to do
You should also note that buff[x-1] is an invalid memory access when x reaches 0 and for a C string of length x you need x+1 bytes (one for terminating null).
The same can be accomplished in a cleaner way when you put the actual recursive functionality in its own function. Without static variables you can now call the function more than once in your program.
Technically most C programs are valid C++ programs.
If you ask your questions here you should explicitly mention that you're using C, though.
Still, I would think that you could get better help from fellow programmers on a C forum.