To answer your original question: It depends.
If you use similar motion in going from the fifth to the octave, that's a non-no.
Doing what you did in the example, maintaining one note of the fifth in the following octave: that's OK, but not ideal.
Ideal is going by contrary motion, but you can't do that in the quoted example.
So, it depends, as I said.
I should also add that if the chord progression isn't specified, you could go to a different chord on the second note, that would make it easier to use contrary motion and would also avoid tripling the root, as you've done, and which is often frowned upon.