The a
modifier to scanf won’t work if you are compiling with the -std=c99
flag; make sure you aren’t using that.
If you have at least version 2.7 of glibc, you can and should use the m
modifier in place of a
.
Also, it is your responsibility to free the buffer.