Understanding spreading processes in complex networks and designing control strategies to contain them is very relevant in epidemiology and public health. In this work, we analyze the problem of controlling spreading processes in networks by distributing protection resources throughout the nodes. In our study, we consider two types of containment resources: (i) Preventive resources able to protect (or immunize) nodes against the spreading (such as vaccines in a viral infection process), and (ii) corrective resources able to neutralize the spreading after it has reached a node, such as antidotes in a viral infection. In our framework, we associate a cost with these resources and study the problem of finding the cost-optimal distribution of resources throughout the network to contain the spreading. In this context, the following question is of particular interest: given a contact network (possibly weighted and/or directed) and resources that provide partial protection (e.g., vaccines and/or antidotes), how should one distribute these resources throughout the networks in a cost optimal manner to contain the spread?