diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 1994-10-04 06:51:42 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1994-10-04 06:51:42 +0000 |
commit | 0c99df0d8d4755f1498ee64f8652d12bab013310 (patch) | |
tree | 3960ed549d2e8a38b0297a3cb4688558637da7df /sys/kern/imgact_gzip.c | |
parent | c5789ba37624587f446cdf8814da74c1fcfd1293 (diff) | |
download | src-0c99df0d8d4755f1498ee64f8652d12bab013310.tar.gz src-0c99df0d8d4755f1498ee64f8652d12bab013310.zip |
Added M_GZIP for the imgact_gzip code. The gzip-code is likely to be used
for other weird things in the future (hint, hint!)
Notes
Notes:
svn path=/head/; revision=3353
Diffstat (limited to 'sys/kern/imgact_gzip.c')
-rw-r--r-- | sys/kern/imgact_gzip.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/kern/imgact_gzip.c b/sys/kern/imgact_gzip.c index 3c24a214b74f..8b425a199189 100644 --- a/sys/kern/imgact_gzip.c +++ b/sys/kern/imgact_gzip.c @@ -7,7 +7,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: imgact_gzip.c,v 1.2 1994/10/03 23:14:48 phk Exp $ + * $Id: imgact_gzip.c,v 1.3 1994/10/04 03:09:13 phk Exp $ * * This module handles execution of a.out files which have been run through * "gzip -9". @@ -53,7 +53,7 @@ struct gzip { int idx; u_long virtual_offset, file_offset, file_end, bss_size; unsigned gz_wp; - u_char gz_slide[WSIZE]; + u_char *gz_slide; }; int inflate __P((struct gzip *)); @@ -86,11 +86,17 @@ exec_gzip_imgact(iparams) /* 4-7 Timestamp */ /* 8 Extra flags */ - gz = malloc(sizeof *gz,M_TEMP,M_NOWAIT); + gz = malloc(sizeof *gz,M_GZIP,M_NOWAIT); if (!gz) return ENOMEM; bzero(gz,sizeof *gz); /* waste of time ? */ + gz->gz_slide = malloc(WSIZE,M_TEMP,M_NOWAIT); + if (!gz->gz_slide) { + free(gz,M_GZIP); + return ENOMEM; + } + gz->ip = iparams; gz->error = ENOEXEC; gz->idx = 10; @@ -136,7 +142,8 @@ exec_gzip_imgact(iparams) done: error = gz->error; - free(gz,M_TEMP); + free(gz->gz_slide,M_TEMP); + free(gz,M_GZIP); return error; } @@ -399,7 +406,7 @@ static void * myalloc(u_long size) { - return malloc(size, M_TEMP, M_NOWAIT); + return malloc(size, M_GZIP, M_NOWAIT); } #define malloc myalloc @@ -407,7 +414,7 @@ static void myfree(void * ptr) { - free(ptr,M_TEMP); + free(ptr,M_GZIP); } #define free myfree |