diff options
-rw-r--r-- | camlibs/hp215/hp215.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/camlibs/hp215/hp215.c b/camlibs/hp215/hp215.c index cd56b3b92..b7d562c1a 100644 --- a/camlibs/hp215/hp215.c +++ b/camlibs/hp215/hp215.c @@ -349,8 +349,11 @@ hp_send_command_and_receive_blob( *msglen = replydatalen; *msg = malloc (replydatalen); ret = gp_port_read (camera->port, (char*)*msg, replydatalen); - if (ret < GP_OK) + if (ret < GP_OK) { + free (*msg); + *msg = NULL; return ret; + } ret = gp_port_read (camera->port, &eot, 1); if (ret < GP_OK) { free (*msg); |