FR 2540 then UX 5043 at Madrid
Bucharest → Madrid → Málaga
Timetable, Madrid time
13:55FR 2540 from Bucharest at the gate
10:30UX 5043 to Málaga leaves the gate
20 h 35 apart on the timetable, overnight
UX 5043 leaves 20 h 35 after FR 2540 arrives on the timetable: more than half a day, so not a connection we count.