mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
make ImgIoUtilReadFile use WebPMalloc instead of malloc
This is a minor technical change in API in case a special allocator was used in WebPMalloc. Change-Id: Idb78a9150d006f158c1a9538525097749e42e7f7
This commit is contained in:
@ -91,7 +91,7 @@ int ImgIoUtilReadFile(const char* const file_name,
|
||||
file_size = ftell(in);
|
||||
fseek(in, 0, SEEK_SET);
|
||||
// we allocate one extra byte for the \0 terminator
|
||||
file_data = (uint8_t*)malloc(file_size + 1);
|
||||
file_data = (uint8_t*)WebPMalloc(file_size + 1);
|
||||
if (file_data == NULL) {
|
||||
fclose(in);
|
||||
WFPRINTF(stderr, "memory allocation failure when reading file %s\n",
|
||||
@ -104,7 +104,7 @@ int ImgIoUtilReadFile(const char* const file_name,
|
||||
if (!ok) {
|
||||
WFPRINTF(stderr, "Could not read %d bytes of data from file %s\n",
|
||||
(int)file_size, (const W_CHAR*)file_name);
|
||||
free(file_data);
|
||||
WebPFree(file_data);
|
||||
return 0;
|
||||
}
|
||||
file_data[file_size] = '\0'; // convenient 0-terminator
|
||||
|
Reference in New Issue
Block a user