

There is still a potential problem here if the entire space between the partitions cannot be added to the first partition because of boundary issues, for example, if the new partition doesn't end on a cylinder boundary.

If there is anything at all between the two partitions you mentioned, you need to address that issue first by extending the first partition by including any unused or unallocated space up to the second partition. With all partition management tools that can perform merge operations, the partitions you want to merge must be adjacent without an intervening partition OR unused/unallocated space.
