diff --git a/libs/framework/src/manifest.c b/libs/framework/src/manifest.c index 2a42378cc..4f0884e90 100644 --- a/libs/framework/src/manifest.c +++ b/libs/framework/src/manifest.c @@ -161,12 +161,12 @@ celix_status_t manifest_read(manifest_pt manifest, const char *filename) { } celix_status_t manifest_readFromStream(manifest_pt manifest, FILE* stream) { - char lbuf[512]; - char *bytes = lbuf; + char stackBuf[512]; + char *bytes = stackBuf; // get file size - if(fseek(stream, 0L, SEEK_END) == -1) { - return CELIX_ERROR_MAKE(CELIX_FACILITY_CERRNO,errno); + if (fseek(stream, 0L, SEEK_END) == -1) { + return CELIX_ERROR_MAKE(CELIX_FACILITY_CERRNO, errno); } long int size = ftell(stream); if (size < 0) { @@ -177,10 +177,10 @@ celix_status_t manifest_readFromStream(manifest_pt manifest, FILE* stream) { } rewind(stream); - celix_autofree char* largeBuf = NULL; - if (size+1 > sizeof(lbuf)) { - largeBuf = bytes = malloc(size+1); - if (largeBuf == NULL) { + celix_autofree char* heapBuf = NULL; + if (size+1 > sizeof(stackBuf)) { + heapBuf = bytes = malloc(size+1); + if (heapBuf == NULL) { celix_err_pushf("Manifest error: failed to allocate %ld bytes", size); return CELIX_ENOMEM; } diff --git a/libs/utils/include/celix_err.h b/libs/utils/include/celix_err.h index 854b8a51c..95ce0d612 100644 --- a/libs/utils/include/celix_err.h +++ b/libs/utils/include/celix_err.h @@ -85,7 +85,7 @@ CELIX_UTILS_EXPORT void celix_err_printErrors(FILE* stream, const char* prefix, /** * @brief Dump error messages from the current thread to the provided buffer. - * @param[in] buf The buffer to dump the error messages to. + * @param[in,out] buf The buffer to dump the error messages to. * @param[in] size The size of the buffer. * @param[in] prefix The prefix to print before each error message. If NULL no prefix is printed. * @param[in] postfix The postfix to print after each error message. If NULL, a '\n' postfix is printed.