By doing this:
kilobyte = NULL, free(kilobyte);
You have a memory leak.
You set kilobyte to NULL, so any memory it pointed to is no longer referenced anywhere. Then, when you execute free(kilobyte) , you effectively execute free(NULL) , which does not perform any operations.
Relatively free(NULL) , from the C standard .
7.22.3.3 free function
1.
#include <stdlib.h> void free(void *ptr);
2. The free function calls the space indicated by ptr freed, that is, available for further distribution. If ptr is a null pointer, no action occurs . Otherwise, if the argument does not match the pointer previously returned by the control function memory, or if the call to free or realloc was freed, the behavior is undefined.
Regarding the source code before editing:
kilobyte = free(kilobyte), NULL;
The problem is that the operator = has a higher priority than the operator, therefore this statement is effective:
(kilobyte = free(kilobyte)), NULL;
This tries to set the void variable, which is not allowed.
What you probably want to do is:
kilobyte = (free(kilobyte), NULL);
This frees the pointer, and then sets the pointer to NULL.
As mentioned by Olaf in the comments, instead of doing everything on one line, it would be preferable to do this instead:
free(kilobyte); kilobyte = NULL;
Doing this is more understandable to the reader than compressing the code into something that others may not understand, and (as you have now seen) less error prone.