Expose WebPMalloc() in addition to WebPFree()

and use it at various places, including for WebPData.

This is an API change!

Change-Id: Ic041323a1179c465292a4f981a86c4c34635d243
This commit is contained in:
Skal
2019-10-15 23:16:51 +02:00
parent af650c0bd2
commit a4df4aae73
12 changed files with 59 additions and 43 deletions

View File

@ -1045,7 +1045,7 @@ static int Process(const Config* config) {
int* durations = NULL;
WebPMux* new_mux = DuplicateMuxHeader(mux);
if (new_mux == NULL) goto Err2;
durations = (int*)malloc((size_t)num_frames * sizeof(*durations));
durations = (int*)WebPMalloc((size_t)num_frames * sizeof(*durations));
if (durations == NULL) goto Err2;
for (i = 0; i < num_frames; ++i) durations[i] = -1;
@ -1103,7 +1103,7 @@ static int Process(const Config* config) {
new_mux = NULL;
Err3:
free(durations);
WebPFree(durations);
WebPMuxDelete(new_mux);
if (!ok) goto Err2;
}