Blame SOURCES/lmdb-covscan.patch

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