[tracker-miners/wip/carlosg/coverity-fixes: 19/28] tracker-extract: Plug leak
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/coverity-fixes: 19/28] tracker-extract: Plug leak
- Date: Sun, 24 Oct 2021 11:33:39 +0000 (UTC)
commit 435192039782c1bd08f2020a8173511e063206dd
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Oct 24 11:41:38 2021 +0200
tracker-extract: Plug leak
The buf variable was being leaked in all return paths.
CID: #366550
src/tracker-extract/tracker-extract-disc-generic.c | 31 +++++++++++++++-------
1 file changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-disc-generic.c
b/src/tracker-extract/tracker-extract-disc-generic.c
index 8daf45ea9..97727d328 100644
--- a/src/tracker-extract/tracker-extract-disc-generic.c
+++ b/src/tracker-extract/tracker-extract-disc-generic.c
@@ -257,6 +257,7 @@ check_is_playstation_image (const guchar *data,
guint8 *buf;
gchar *ptr;
PsDiscMode1Frame frame;
+ gboolean is_ps = FALSE;
if (!ps_disc_read_frame (data, length, &time, &frame))
return FALSE;
@@ -274,16 +275,18 @@ check_is_playstation_image (const guchar *data,
g_debug ("SYSTEM.CNF found, looking for executable");
if (!ps_disc_read_frame (data, length, &time, &frame))
- return FALSE;
+ goto out;
/* Look of "BOOT = cdrom:" */
if (ps_disc_lookup_executable_filename ((gchar *) frame.content,
"BOOT = cdrom:",
G_N_ELEMENTS (exe_buffer),
exe_buffer)) {
- g_debug ("Executable '%s' found", exe_buffer);
- if (ps_disc_get_file (buf, 4096, exe_buffer, NULL))
- return TRUE;
+ if (ps_disc_get_file (buf, 4096, exe_buffer, NULL)) {
+ g_debug ("Executable '%s' found", exe_buffer);
+ is_ps = TRUE;
+ goto out;
+ }
}
/* Look of "cdrom:" */
@@ -293,22 +296,30 @@ check_is_playstation_image (const guchar *data,
"cdrom:",
G_N_ELEMENTS (exe_buffer),
exe_buffer)) {
- g_debug ("Executable '%s' found", exe_buffer);
- if (ps_disc_get_file (buf, 4096, exe_buffer, NULL))
- return TRUE;
+ if (ps_disc_get_file (buf, 4096, exe_buffer, NULL)) {
+ g_debug ("Executable '%s' found", exe_buffer);
+ is_ps = TRUE;
+ goto out;
+ }
}
- return FALSE;
+ goto out;
}
/* Look for the default PSX.EXE executable. */
if (ps_disc_get_file (buf, 4096, "PSX.EXE;1", NULL)) {
g_debug ("PSX.EXE found");
- return TRUE;
+ is_ps = TRUE;
+ goto out;
}
/* SYSTEM.CNF and PSX.EXE not found. */
- return FALSE;
+ is_ps = FALSE;
+
+ out:
+ g_free (buf);
+
+ return is_ps;
}
static GMappedFile *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]