I didn't check in details, but the principle seems right. Are you still encountering any problems?
The only strange thing I found was this
/* Done with these, time to clean up after ourselves. */
printf("***********match_count %d\n",match_count);
// free(receive_ptr_rx);
why did you comment the free() call here? It should be the right place to do so, inside the for loop. If you put that line with the other free() calls at the end of your function you will only free the last buffer and not the first ones, and you'll have a memory leak.