[Midnightbsd-cvs] src [12078] trunk/lib/libmport/index.c: clean up return cases

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Sep 28 08:39:14 EDT 2018


Revision: 12078
          http://svnweb.midnightbsd.org/src/?rev=12078
Author:   laffer1
Date:     2018-09-28 08:37:40 -0400 (Fri, 28 Sep 2018)
Log Message:
-----------
clean up return cases

Modified Paths:
--------------
    trunk/lib/libmport/index.c

Modified: trunk/lib/libmport/index.c
===================================================================
--- trunk/lib/libmport/index.c	2018-09-28 12:24:45 UTC (rev 12077)
+++ trunk/lib/libmport/index.c	2018-09-28 12:37:40 UTC (rev 12078)
@@ -278,14 +278,14 @@
 
 	e = (mportIndexEntry **) calloc((size_t) count + 1, sizeof(mportIndexEntry *));
 	if (e == NULL) {
-		ret = MPORT_ERR_FATAL;
-		goto DONE;
+		free(lookup);
+		RETURN_ERROR(MPORT_ERR_FATAL, "Could not allocate memory for index entries");
 	}
 	*entry_vec = e;
 
 	if (count == 0) {
-		ret = MPORT_OK;
-		goto DONE;
+		free(lookup);
+		return MPORT_OK;
 	}
 
 	if (mport_db_prepare(mport->db, &stmt,
@@ -364,8 +364,8 @@
 
 	e = (mportIndexEntry **)calloc((size_t) len + 1, sizeof(mportIndexEntry *));
 	if (e == NULL) {
-		ret = MPORT_ERR_FATAL;
-		goto DONE;
+		sqlite3_free(where);
+		RETURN_ERROR(MPORT_ERR_FATAL, "Could not allocate memory");
 	}
 	*entry_vec = e;
 



More information about the Midnightbsd-cvs mailing list