Skip to contentSkip to conversation

swsusp: do not leak memory if there's an error during suspend

PATCH New Rafael J. Wysocki 1 participant 1 message Mar 19, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 swsusp: do not leak memory if there's an error during suspend

Hi,

The following patch prevents swsusp from leaking memory if there's an error during suspend (eg when device_power_down() returns non-zero).

Greets,
Rafael

kernel/power/swsusp.c +3 -1
@@ -894,10 +894,12 @@ int swsusp_suspend(void)
 	 */
 	if ((error = device_power_down(PMSG_FREEZE))) {
 		local_irq_enable();
+		swsusp_free();
 		return error;
 	}
 	save_processor_state();
-	error = swsusp_arch_suspend();
+	if ((error = swsusp_arch_suspend()))
+		swsusp_free();
 	/* Restore control flow magically appears here */
 	restore_processor_state();
 	BUG_ON (nr_copy_pages_check != nr_copy_pages);
Signature · 3 lines
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"