From e0bb1b7e7fbe4f89b8a994b6883bbeb1a2ee3dc0 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Wed, 1 May 2013 12:13:28 +0000 Subject: [PATCH] free buf in error path git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14377 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/hp215/hp215.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/camlibs/hp215/hp215.c b/camlibs/hp215/hp215.c index 8f4afda4f..b14d6853f 100644 --- a/camlibs/hp215/hp215.c +++ b/camlibs/hp215/hp215.c @@ -182,6 +182,8 @@ hp_gen_cmd_blob (enum hp215_cmd cmd, int bytes, unsigned char *argdata, unsigned (*buf)[1] = cmd; if (bytes >= 0x7d) { gp_log (GP_LOG_ERROR, "hp215", "Using too large argument buffer %d bytes", bytes); + free (*buf); + *buf = NULL; return GP_ERROR_BAD_PARAMETERS; } /* store arglen */ @@ -395,6 +397,7 @@ hp_get_timeDate_cam (Camera *cam, char *txtbuffer, size_t txtbuffersize) return ret; xmsg = msg; if (msglen < 0x59) { + free (msg); gp_log (GP_LOG_ERROR, "hp215", "too short reply block, %d bytes", msglen); return GP_ERROR_IO; }