Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106949208
D17144.id49364.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D17144.id49364.diff
View Options
Index: head/sys/kern/subr_compressor.c
===================================================================
--- head/sys/kern/subr_compressor.c
+++ head/sys/kern/subr_compressor.c
@@ -275,8 +275,9 @@
ZSTD_CCtx *dump_compressor;
struct zstdio_stream *s;
void *wkspc, *owkspc, *buffer;
- size_t wkspc_size, buf_size;
+ size_t wkspc_size, buf_size, rc;
+ s = NULL;
wkspc_size = ZSTD_estimateCStreamSize(level);
owkspc = wkspc = malloc(wkspc_size + 8, M_COMPRESS,
M_WAITOK | M_NODUMP);
@@ -286,12 +287,23 @@
dump_compressor = ZSTD_initStaticCCtx(wkspc, wkspc_size);
if (dump_compressor == NULL) {
- free(owkspc, M_COMPRESS);
printf("%s: workspace too small.\n", __func__);
- return (NULL);
+ goto out;
}
- (void)ZSTD_CCtx_setParameter(dump_compressor, ZSTD_p_checksumFlag, 1);
+ rc = ZSTD_CCtx_setParameter(dump_compressor, ZSTD_p_checksumFlag, 1);
+ if (ZSTD_isError(rc)) {
+ printf("%s: error setting checksumFlag: %s\n", __func__,
+ ZSTD_getErrorName(rc));
+ goto out;
+ }
+ rc = ZSTD_CCtx_setParameter(dump_compressor, ZSTD_p_compressionLevel,
+ level);
+ if (ZSTD_isError(rc)) {
+ printf("%s: error setting compressLevel: %s\n", __func__,
+ ZSTD_getErrorName(rc));
+ goto out;
+ }
buf_size = ZSTD_CStreamOutSize() * 2;
buffer = malloc(buf_size, M_COMPRESS, M_WAITOK | M_NODUMP);
@@ -306,6 +318,9 @@
zstdio_reset(s);
+out:
+ if (s == NULL)
+ free(owkspc, M_COMPRESS);
return (s);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 8, 10:42 PM (3 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15727107
Default Alt Text
D17144.id49364.diff (1 KB)
Attached To
Mode
D17144: ZSTDIO: Correctly initialize zstd context with provided 'level'
Attached
Detach File
Event Timeline
Log In to Comment