Thanks SVACE
Change-Id: Ic2774946c10e7d9e5e9c6279446aa388d0cbb84d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
ui->n_threads = n_threads;
ui->threads = malloc(sizeof (void *) * n_threads);
+ if (!ui->threads)
+ {
+ Debug(0, "Allocation failed");
+ goto err;
+ }
n_threads = 0;
note_hdr = (Elf32_Nhdr *)ui->note_phdr;
/* Ignore separate debug files which contain a .gnu_debuglink section. */
if (linkbuf && is_local == -1)
- {
- free (linkbuf);
- return 1;
- }
+ goto alloc_error;
if (*buf == NULL && linkbuf != NULL && memchr (linkbuf, 0, linksize) != NULL)
{
/* XXX: Don't bother with the checksum; just search for the file. */
basedir = malloc (strlen (file) + 1);
+ if (!basedir)
+ goto alloc_error;
+
newname = malloc (strlen (linkbuf) + strlen (debugdir)
+ strlen (file) + 9);
+ if (!newname)
+ {
+ free(basedir);
+ goto alloc_error;
+ }
p = strrchr (file, '/');
if (p != NULL)
file_error:
free(stringtab);
free(sec_hdrs);
- free(linkbuf);
fclose(f);
+alloc_error:
+ free(linkbuf);
+
return 1;
}