Blame SOURCES/lmdb-covscan.patch

a35783
diff -up ./libraries/liblmdb/midl.c.fix ./libraries/liblmdb/midl.c
a35783
--- ./libraries/liblmdb/midl.c.fix	2019-06-19 11:10:07.791337785 +0200
a35783
+++ ./libraries/liblmdb/midl.c	2019-06-19 11:16:04.005166705 +0200
a35783
@@ -120,9 +120,15 @@ void mdb_midl_free(MDB_IDL ids)
a35783
 void mdb_midl_shrink( MDB_IDL *idp )
a35783
 {
a35783
 	MDB_IDL ids = *idp;
a35783
-	if (*(--ids) > MDB_IDL_UM_MAX &&
a35783
-		(ids = realloc(ids, (MDB_IDL_UM_MAX+2) * sizeof(MDB_ID))))
a35783
+  MDB_IDL res = NULL;
a35783
+	if (*(--ids) > MDB_IDL_UM_MAX)
a35783
 	{
a35783
+    res = realloc(ids, (MDB_IDL_UM_MAX+2) * sizeof(MDB_ID));
a35783
+    if (res)
a35783
+      ids = res;
a35783
+    else
a35783
+      return;
a35783
+
a35783
 		*ids++ = MDB_IDL_UM_MAX;
a35783
 		*idp = ids;
a35783
 	}
a35783
@@ -131,10 +137,13 @@ void mdb_midl_shrink( MDB_IDL *idp )
a35783
 static int mdb_midl_grow( MDB_IDL *idp, int num )
a35783
 {
a35783
 	MDB_IDL idn = *idp-1;
a35783
+  MDB_IDL res = NULL;
a35783
 	/* grow it */
a35783
-	idn = realloc(idn, (*idn + num + 2) * sizeof(MDB_ID));
a35783
-	if (!idn)
a35783
+	res = realloc(idn, (*idn + num + 2) * sizeof(MDB_ID));
a35783
+	if (!res)
a35783
 		return ENOMEM;
a35783
+  else
a35783
+    idn = res;
a35783
 	*idn++ += num;
a35783
 	*idp = idn;
a35783
 	return 0;