Skip to content

Commit

Permalink
[dev] if data is null, free it, not safe
Browse files Browse the repository at this point in the history
  • Loading branch information
shijie.chen committed Jan 17, 2024
1 parent 4c901a0 commit f09ea44
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions library/JQLibrary/src/JQZopfli/zopflipng/lodepng/lodepng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4733,9 +4733,13 @@ unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h,
if(!(*out))
{
state->error = 83; /*alloc fail*/
return state->error;
}
else
{
data = *out;
state->error = lodepng_convert(*out, data, &state->info_raw, &state->info_png.color, *w, *h);
}
else state->error = lodepng_convert(*out, data, &state->info_raw,
&state->info_png.color, *w, *h);
lodepng_free(data);
}
return state->error;
Expand Down

0 comments on commit f09ea44

Please sign in to comment.