diff options
author | Li kunyu <kunyu@nfschina.com> | 2022-12-15 15:36:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-15 08:36:37 +0100 |
commit | d8d50f3d608049fdf29849e8889c2ed85cf6cea1 (patch) | |
tree | c6fe6ee4659fd022026df564f9a285899f35c15f /camlibs | |
parent | 7be692414f95b42d8b63566d379be65de3d0e6fb (diff) | |
download | libgphoto2-d8d50f3d608049fdf29849e8889c2ed85cf6cea1.tar.gz |
serial: Add check after malloc allocation (#878)
Diffstat (limited to 'camlibs')
-rw-r--r-- | camlibs/jd11/serial.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/camlibs/jd11/serial.c b/camlibs/jd11/serial.c index 31d3701e4..3a0325ee4 100644 --- a/camlibs/jd11/serial.c +++ b/camlibs/jd11/serial.c @@ -507,6 +507,12 @@ jd11_get_image_full( } gp_file_append(file, IMGHEADER, strlen(IMGHEADER)); data = malloc(640*480*3); + if (!data) { + free(uncomp[0]);free(uncomp[1]);free(uncomp[2]); + free(imagebufs[0]);free(imagebufs[1]);free(imagebufs[2]);free(imagebufs); + return GP_ERROR_NO_MEMORY; + } + if (!raw) { unsigned char *bayerpre; s = bayerpre = malloc(640*480); |