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 63a40d790f602c81d6f28e71e02b6d46d907cd5d..7a6d3f22e2361c42b5faca9d2ba240688215faec 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;
 }
 
 /**