Hi all,
I found a missing check about malloc fault and memory not deallocated.

Regards,
Manuele
=== modified file 'uspace/lib/drv/generic/remote_ahci.c'
--- uspace/lib/drv/generic/remote_ahci.c	2015-08-23 12:50:23 +0000
+++ uspace/lib/drv/generic/remote_ahci.c	2016-03-16 13:06:29 +0000
@@ -221,7 +221,10 @@
 	    (size_t) DEV_IPC_GET_ARG1(*call);
 	
 	char* sata_dev_name = malloc(sata_dev_name_length);
-	
+	if (sata_dev_name == NULL) {
+		async_answer_0(callid, ENOMEM);
+		return;
+	}	
 	const int ret = ahci_iface->get_sata_device_name(fun,
 	    sata_dev_name_length, sata_dev_name);
 	
@@ -230,7 +233,8 @@
 	if ((async_data_read_receive(&cid, &real_size)) &&
 	    (real_size == sata_dev_name_length))
 		async_data_read_finalize(cid, sata_dev_name, sata_dev_name_length);
-	
+
+	free(sata_dev_name);
 	async_answer_0(callid, ret);
 }
 

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to