It's confusing to use ```queue_size``` for the ```malloc``` case, but not the ```realloc``` case.  Either move it inside the ```if```, or use it consistently for both branches.