Salvation is by grace through faith, without works to obtain or to keep it. Good works SHOULD exemplify the life of the believer but (1) good works of the non-miraculous kind can AND ARE expertly counterfeited, and (2) believers still have the old man to contend with, making the exhibition of good works rarely if ever consistent - just look at Corinth's saints, and Galatia's. Paul did excoriate them for their various sinful practices and doctrinal straying from the revelation of the mystery but never said they were not saved or were in danger of losing Christ, or more precisely, of Christ losing them. Paul is not warning saved people that they can sin away their salvation. To do so would contradict the other passages where Paul was inspired to write how eternal security in Christ is permanent and unconditional.
Rather, Paul is warning them of something he hints at in a few places in his letters, which many eternal security haters seem to miss:
Because salvation is by grace through faith, there's no humanly possible way to know with absolute 100% certainty that someone else is truly in Christ. You can BELIEVE and HOPE they are, and you might well be right, but you cannot KNOW. Only Christ knows for sure who are His.
That means NO ONE - not even Paul - could know with certainty who was truly His. Yes, he'd seen their faith and yes, he'd seen miracles among them and yes, he'd seen good works. But this is so many people seem not to notice in Paul's letters: He warns them to make sure they are in fact in the faith...to make sure FOR THEMSELVES that they are in Christ. Why would Paul order this step be taken? Not because a sinner sealed into Christ by the Holy Spirit can lose his complete justification by God for such is impossible, else God is a liar. No, Paul's warnings are to make the point that those who repeatedly indulge in sin without any sign of conviction or repentence may not actually be saved.
But even here, keep in mind the balance. Good works and externally moral behaviors alone, even coupled with a profession of Christ, cannot prove to others one is saved. Christ Himself said so, "Depart from me, ye..." Likewise, frequent sin does not automatically mean someone is not in Christ, for - don't lie! - we ALL have our besetting sins with which we struggle despite the increasing victories God grants us through His Spirit as we grow into the image of Christ.
A case study: the man in Corith who was sleeping with his mother (I hold to the view that it's very possible he was committing the worst kind of incest, not merely fornicating with his father's new wife). What did Paul order regarding this man?
First look at what Paul did NOT order be done with him. Paul did NOT order that some solid team of elders at Corinth take the man aside and preach the Gospel to him to make sure he acutally believed it, which Paul would have done had he believed the man was not a Christian - for this was Paul, the one who begs in God's stead that the lost be saved. Did Paul order them to do that with this guy?
No. Paul DID acknowledge and judge his sin (for the elders apparently had not) and ordered them to shun him and expel him from fellowship, turned over to Satan for the destruction of his flesh that he might be saved on that Day.
My point is, if Paul was absolutely sure - as a miracle-working apostle - that this man was not saved, or had LOST his salvation, he'd have treated him differently. As it was, he treated him as a BELIEVER who was to be harshly disciplined until he repented, WHICH HE DID. Note that well, gentlemen: the guy REPENTED and was RESTORED TO FELLOWSHIP. He was not kicked out of the church to be saved (or saved again!) on the OUTSIDE among heathen pagans! He truly repented, which a truly saved person will eventually do under the convicting hand of the Holy Spirit, proving Paul's treatment of him was right because that the guy really was saved, despite doubts Paul must have had.
Here's the main point: if there is one example in all of the N.T. that shows someone during the dispensation of grace obtaining salvation but then losing it, this brother in Corinth HAS to be that guy. But he never lost his salvation.
To be warned by Paul that one's unrepentant sins may be evidence he/she is not really saved (and it is for that individual to judge for sure) is NOT the same as Paul warning believers they can sin away their savlation. That is two totally different propositions. The first is found in Paul's writings. The second is not.
This is the reason we're not to judge the heart condition of those who profess the true saving Gospel of grace. We simply cannot know, but we don't need to know because God does. Judging sin (including false doctrine, which is very much sin) is a wholly different matter we are commanded to judge, for leaven always spreads unless it is stopped and removed.
But to judge someone's actually standing before God, even if they profess Christ alone as their only hope of salvation? Not even Paul dared to judge that, so some of you here need to cool out - you're arrogantly daring to step on ground that not even the greatest of the apostles dared tread, and God is watching you do it.