summaryrefslogtreecommitdiff
path: root/camlibs/ricoh
diff options
context:
space:
mode:
Diffstat (limited to 'camlibs/ricoh')
-rw-r--r--camlibs/ricoh/g3.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/camlibs/ricoh/g3.c b/camlibs/ricoh/g3.c
index cce3e697f..096f27ce8 100644
--- a/camlibs/ricoh/g3.c
+++ b/camlibs/ricoh/g3.c
@@ -77,6 +77,10 @@ g3_channel_read(GPPort *port, int *channel, char **buffer, unsigned int *len)
*buffer = malloc(*len + 1 + 0x800);
else
*buffer = realloc(*buffer, *len + 1 + 0x800);
+ if (!*buffer) {
+ gp_log(GP_LOG_ERROR, "g3" ,"malloc failed, size %d too large?\n", *len+1+0x800);
+ return GP_ERROR_NO_MEMORY;
+ }
tocopy = *len;
if (tocopy > 0x800-8) tocopy = 0x800-8;
memcpy(*buffer, xbuf+8, tocopy);