diff options
author | imp <imp@FreeBSD.org> | 1998-09-16 04:17:47 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1998-09-16 04:17:47 +0000 |
commit | bfe73fd683053201c326f9ff2c8e5e0f69cc7fe7 (patch) | |
tree | b17d45198953bfbbad4bfd632dfdf1a37b7159d2 /lib/libc/db/recno | |
parent | 68a8c771724d4fc671cac3ce95f78d4fb1874cfe (diff) | |
download | FreeBSD-src-bfe73fd683053201c326f9ff2c8e5e0f69cc7fe7.zip FreeBSD-src-bfe73fd683053201c326f9ff2c8e5e0f69cc7fe7.tar.gz |
Replace memory leaking instances of realloc with non-leaking reallocf.
In some cases replace if (a == null) a = malloc(x); else a =
realloc(a, x); with simple reallocf(a, x). Per ANSI-C, this is
guaranteed to be the same thing.
I've been running these on my system here w/o ill effects for some
time. However, the CTM-express is at part 6 of 34 for the CAM
changes, so I've not been able to do a build world with the CAM in the
tree with these changes. Shouldn't impact anything, but...
Diffstat (limited to 'lib/libc/db/recno')
-rw-r--r-- | lib/libc/db/recno/rec_get.c | 6 | ||||
-rw-r--r-- | lib/libc/db/recno/rec_put.c | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/lib/libc/db/recno/rec_get.c b/lib/libc/db/recno/rec_get.c index 47dd773..0a8b880 100644 --- a/lib/libc/db/recno/rec_get.c +++ b/lib/libc/db/recno/rec_get.c @@ -132,7 +132,7 @@ __rec_fpipe(t, top) if (t->bt_rdata.size < t->bt_reclen) { t->bt_rdata.data = t->bt_rdata.data == NULL ? malloc(t->bt_reclen) : - realloc(t->bt_rdata.data, t->bt_reclen); + reallocf(t->bt_rdata.data, t->bt_reclen); if (t->bt_rdata.data == NULL) return (RET_ERROR); t->bt_rdata.size = t->bt_reclen; @@ -205,7 +205,7 @@ __rec_vpipe(t, top) t->bt_rdata.size += (sz = 256); t->bt_rdata.data = t->bt_rdata.data == NULL ? malloc(t->bt_rdata.size) : - realloc(t->bt_rdata.data, t->bt_rdata.size); + reallocf(t->bt_rdata.data, t->bt_rdata.size); if (t->bt_rdata.data == NULL) return (RET_ERROR); p = (u_char *)t->bt_rdata.data + len; @@ -244,7 +244,7 @@ __rec_fmap(t, top) if (t->bt_rdata.size < t->bt_reclen) { t->bt_rdata.data = t->bt_rdata.data == NULL ? malloc(t->bt_reclen) : - realloc(t->bt_rdata.data, t->bt_reclen); + reallocf(t->bt_rdata.data, t->bt_reclen); if (t->bt_rdata.data == NULL) return (RET_ERROR); t->bt_rdata.size = t->bt_reclen; diff --git a/lib/libc/db/recno/rec_put.c b/lib/libc/db/recno/rec_put.c index 1afae0d..0a5bddf 100644 --- a/lib/libc/db/recno/rec_put.c +++ b/lib/libc/db/recno/rec_put.c @@ -88,9 +88,8 @@ __rec_put(dbp, key, data, flags) goto einval; if (t->bt_rdata.size < t->bt_reclen) { - t->bt_rdata.data = t->bt_rdata.data == NULL ? - malloc(t->bt_reclen) : - realloc(t->bt_rdata.data, t->bt_reclen); + t->bt_rdata.data = + reallocf(t->bt_rdata.data, t->bt_reclen); if (t->bt_rdata.data == NULL) return (RET_ERROR); t->bt_rdata.size = t->bt_reclen; |