cppcheck: fix memory leaks
This commit is contained in:
parent
2ecb3edfb4
commit
6ed942ef05
|
@ -1116,6 +1116,7 @@ static int cmd_print(void *data, const char *input) {
|
|||
p = malloc (core->blocksize);
|
||||
if (!p) {
|
||||
eprintf ("Error: failed to malloc memory");
|
||||
free(ptr);
|
||||
return R_FALSE;
|
||||
}
|
||||
for (i=0; i<psz; i++) {
|
||||
|
|
|
@ -184,8 +184,10 @@ static int varsub(RParse *p, RAnalFunction *f, char *data, char *str, int len) {
|
|||
char *tstr = strdup (data);
|
||||
RList *vars, *args;
|
||||
|
||||
if (!p->varlist)
|
||||
if (!p->varlist) {
|
||||
free(tstr);
|
||||
return R_FALSE;
|
||||
}
|
||||
|
||||
vars = p->varlist (p->anal, f, 'v');
|
||||
args = p->varlist (p->anal, f, 'a');
|
||||
|
|
|
@ -693,8 +693,11 @@ node.offsets = malloc ((nodesize*sizeof(grub_uint16_t))/2);
|
|||
(type == 0) ? GRUB_HFS_CNID_CAT : GRUB_HFS_CNID_EXT,
|
||||
idx / (data->blksz / nodesize), 0);
|
||||
blk += (idx % (data->blksz / nodesize));
|
||||
if (grub_errno)
|
||||
if (grub_errno) {
|
||||
free (node.rawnode);
|
||||
free (node.offsets);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
if (grub_disk_read (data->disk, blk, 0,
|
||||
sizeof (node), &node)) {
|
||||
|
|
|
@ -116,8 +116,10 @@ int rarvm_assemble (Bitbuf *b, const char *c) {
|
|||
|
||||
if (opcodes[opnum].flags & 1) {
|
||||
SKIPSPACES (arg0);
|
||||
if (!assemble_arg (b, arg0))
|
||||
if (!assemble_arg (b, arg0)) {
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
if (opcodes[opnum].flags & 2) {
|
||||
SKIPSPACES (arg1);
|
||||
if (!assemble_arg (b, arg1))
|
||||
|
|
Loading…
Reference in New Issue