What is the function of 贴 in 四贴袋？ I can't figure out what 贴 is doing here:

中国革命先行者孙中山综合了西式服装与中式服装的特点，设计出了一种直翻领有袋盖的四贴袋男用套装，定名为中山装，此后几十年，中山装大为流行，成为中国男子喜欢的标准服装。

‘四贴袋‘ is 贴 a 量词 here?
贴 in 四贴袋 is not measure word but adjective, meaning pasted. It describes the appearance of the pocket is like it's pasted/patched on the suit.
When 贴袋 is used as noun, you can use any measure word that's applicable to a pocket. E.g.

这件衣服上有四个贴袋。

But in your example, 四贴袋 is noun-as-adjective (数词+名词短语做定语), in which situation there should not be measure words in between, and strictly speaking, 四 here is not nominal number four but tuple nomenclature quad. Some other examples:

三轮车 three-wheel(ed) vehicle
多功能全自动洗衣机 multi-function automatic washing machine
四贴袋男用套装 four/quad-patch pocket men's suit