Skip to contentSkip to conversation

libsemanage: database_file.c uninit'd deref

PATCH New Serge E. Hallyn 1 participant 1 message Jun 8, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 libsemanage: database_file.c uninit'd deref

Actually a short set of patches for all of libsemanage.

This first one addresses a potential deref of uninitialized parse_info on the error path.

thanks,
-serge

src/database_file.c renamed from src/database_file.c.orig +5 -3
@@ -69,7 +69,7 @@ static int dbase_file_cache(
 	record_t* process_record = NULL;
 	int pstatus = STATUS_SUCCESS;
 
-	parse_info_t* parse_info;
+	parse_info_t* parse_info = NULL;
 	char* fname = NULL;
 
 	/* Already cached */
@@ -127,8 +127,10 @@ static int dbase_file_cache(
 	err:
 	ERR(handle, "could not cache file database");
 	rtable->free(process_record);
-	parse_close(parse_info);
-	parse_release(parse_info);
+	if (parse_info) {
+		parse_close(parse_info);
+		parse_release(parse_info);
+	}
 	dbase_llist_drop_cache(&dbase->llist);
 	free(fname);
 	return STATUS_ERR;

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.