All notes that have accidentals placed before them revert back to the original note after each barline, in other words, the accidental changes only those notes in the measure where the accidental is found. The only exception to this is when a note is tied across the barline. Any subsequent note would revert back to the note in the key signature. This often usd to facilitate the easier reading of the notation in highly chromatic passages.
In the example below, several courtesy accidentals are shown. In the first measure of the treble clef, a D natural below the staff is a courtesy accidental from the previous measure (not shown). In the second measure in the treble clef, the note E in the top space is altered by a natural symbol which raises the pitch by one semitone (one half step). Since the natural sign alters all occurences of the top space note E in this measure, there is no need for any additional accidental sign. The editor, however, uses a courtesy accidental (this time within parentheses) to remind the performer that the note E continues to be altered by the previous accidental.
In the first measure of the bass clef, the note D shown above the staff and is altered with a flat accidental to lower that note to a D flat. The second D above the staff in the same measure uses a courtesy accidental (the flat accidental) to remind the performer that the D has been altered in this measure. The barline removes the effect of the accidental, so the note D in the bass clef of the second measure is no longer lowered. The composer has added the natural sign as a courtesy accidental to remind the performer that the previous accidental is no longer in effect. Additionally, the E flat on the second ledger line above the staff uses a courtesy accidental to remind the performer that the E natural in the previous measure is no longer in effect. Notice that the courtesy accidental is used in this situation, even though the earlier accidental was with a different octave.
See also courtesy accidental; cautionary accidental; reminder accidental.