summaryrefslogtreecommitdiff
path: root/net/pppd/patches/patch-ba
blob: 0addef16a3dde2e212e0305b9c98ad4e408a8fcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$NetBSD: patch-ba,v 1.1.1.1 2005/01/02 02:51:43 cube Exp $

--- pppd/tdb.c.orig	2004-11-13 08:13:07.000000000 +0100
+++ pppd/tdb.c
@@ -193,6 +193,8 @@ void tdb_set_lock_alarm(sig_atomic_t *pa
 	palarm_fired = palarm;
 }
 
+static int tdb_update_hash __P((TDB_CONTEXT *, TDB_DATA, u32, TDB_DATA));
+
 /* a byte range locking function - return 0 on success
    this functions locks/unlocks 1 byte at the specified offset.
 
@@ -800,9 +802,13 @@ static int tdb_expand(TDB_CONTEXT *tdb, 
 
 	tdb->map_size += size;
 
-	if (tdb->flags & TDB_INTERNAL)
-		tdb->map_ptr = realloc(tdb->map_ptr, tdb->map_size);
-	else {
+	if (tdb->flags & TDB_INTERNAL) {
+		void *n;
+		n = realloc(tdb->map_ptr, tdb->map_size);
+		if (!n)
+			goto fail;
+		tdb->map_ptr = n;
+	} else {
 		/*
 		 * We must ensure the file is remapped before adding the space
 		 * to ensure consistency with systems like OpenBSD where