Correct a few allocation issues reported by Valgrind:
- Size of dvb_file is wrong;
- getline requires a free after end using it;
- entries should be freed at dvb_file_free().
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
while (entry) {
next = entry->next;
if (entry->channel)
- free (entry->channel);
+ free(entry->channel);
if (entry->vchannel)
- free (entry->vchannel);
+ free(entry->vchannel);
if (entry->location)
- free (entry->location);
+ free(entry->location);
if (entry->video_pid)
- free (entry->video_pid);
+ free(entry->video_pid);
if (entry->audio_pid)
- free (entry->audio_pid);
+ free(entry->audio_pid);
if (entry->other_el_pid)
- free (entry->other_el_pid);
+ free(entry->other_el_pid);
if (entry->lnb)
- free (entry->lnb);
+ free(entry->lnb);
+ free(entry);
entry = next;
}
- free (dvb_file);
+ free(dvb_file);
}
/* From dvb-legacy-channel-format.c */
}
} while (1);
- fclose (fd);
+ fclose(fd);
+ free(buf);
return dvb_file;
error:
err_msg, line, fname);
dvb_file_free(dvb_file);
fclose(fd);
+ free(buf);
return NULL;
}
int rc;
if (!*dvb_file) {
- *dvb_file = calloc(sizeof(*dvb_file), 1);
+ *dvb_file = calloc(sizeof(**dvb_file), 1);
if (!*dvb_file) {
dvb_perror("Allocating memory for dvb_file");
return -1;