Only use glib memory allocation functions in lib/rsa .c

Since all the other functions in lib/rsa.c are using the glib memory allocation
functions, we do the same in public_key_to_gstring and
public_key_append_to_gstring to avoid the typical realloc error that exists,
which will overwrite the pointer with NULL without freeing the previous
allocated memory. Since there exists no proper error handling and the other
functions are using the glib functions, this patch replaces the memory
allocation functions of stdlib with those of glib.