bb11388 memory allocation failure handling. Patches by Bill Parker.

pull/27/head
Steven Morgan 10 years ago
parent a859ba58d2
commit 32ad1c56bd
  1. 4
      libclamav/json_api.c
  2. 3
      libclamav/pe_icons.c

@ -453,6 +453,10 @@ int cli_jsonstr_nojson(const char* key, const char* s)
int cli_jsonstrlen_nojson(const char* key, const char* s, int len)
{
char *sp = cli_malloc(len+1);
if (NULL == sp) {
cli_errmsg("json: no memory for json strlen object.\n");
return CL_EMEM;
}
strncpy(sp, s, len);
sp[len] = '\0';

@ -1555,7 +1555,8 @@ static int parseicon(struct ICON_ENV *icon_env, uint32_t rva) {
scalex = (double)width / newsize;
scaley = (double)height / newsize;
if(!(newdata = cli_malloc(newsize * newsize * sizeof(*newdata)))) {
return CL_SUCCESS;
cli_errmsg("parseicon: Unable to allocate memory for scaling image\n");
return CL_EMEM;
}
cli_dbgmsg("parseicon: Slow scaling to %ux%u (%f, %f)\n", newsize, newsize, scalex, scaley);
for(y = 0; y<newsize; y++) {

Loading…
Cancel
Save