diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2006-12-14 08:08:03 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2006-12-14 08:08:03 +0000 |
commit | deb014d138e9d8a4101fa83c8602779fb10e945c (patch) | |
tree | da129c5a003782ce5c0e80fc9fc047988d7eb6e6 | |
parent | b4b5a5ff3cb2ad1fa615626b75daed51a46e253a (diff) | |
download | libgphoto2-deb014d138e9d8a4101fa83c8602779fb10e945c.tar.gz |
check for out of memory and not copy blindly over NULL ptr.s
git-svn-id: https://svn.code.sf.net/p/gphoto/code/branches/libgphoto2-2_3/libgphoto2@9592 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r-- | camlibs/ptp2/ptp.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index e160fe175..63bd6c362 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -288,6 +288,10 @@ ptp_usb_getdata (PTPParams* params, PTPContainer* ptp, if (to_fd == -1) { /* Allocate memory for data. */ *data=calloc(len,1); + if (!*data) { + ptp_error (params, "PTP: Out of memory on allocating %d bytes.", len); + return PTP_ERROR_IO; + } if (readlen) *readlen = len; |