aft: Make get_audio_file_path_of_row() more robust.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 9 Jul 2017 13:05:53 +0000 (15:05 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 12 Aug 2017 18:18:13 +0000 (20:18 +0200)
On errors we used to leave the path pointer uninitialized. This
commit sets it to NULL in this case.

aft.c

diff --git a/aft.c b/aft.c
index 63a40d7..7a6d3f2 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -542,10 +542,12 @@ int get_audio_file_path_of_row(const struct osl_row *row, char **path)
        struct osl_object path_obj;
        int ret = osl(osl_get_object(audio_file_table, row, AFTCOL_PATH,
                &path_obj));
+
        if (ret < 0)
-               return ret;
-       *path = path_obj.data;
-       return 1;
+               *path = NULL;
+       else
+               *path = path_obj.data;
+       return ret;
 }
 
 /**