Coverity: Uninit: CID 473
authorNelson Ferreira <nelson.ferreira@ieee.org>
Sun, 15 Jan 2012 02:47:51 +0000 (21:47 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Sun, 15 Jan 2012 02:47:51 +0000 (21:47 -0500)
* src/media/media-sndfile.c (media_sndfile_open): Make sure to
only call sf_open if file name was properly converted.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/media/media-sndfile.c

index 5bf16bb..d6e86da 100644 (file)
@@ -98,14 +98,16 @@ media_sndfile_open(Lisp_Media_Stream *ms)
        switch (media_stream_kind(ms)) {
        case MKIND_FILE: {
                mkind_file_properties *mkfp = NULL;
-               const char *file;
+               const char *file = NULL;
                int file_len = 0;
 
                /* open the file */
                mkfp = media_stream_kind_properties(ms).fprops;
                TO_EXTERNAL_FORMAT(LISP_STRING, mkfp->filename,
                                   ALLOCA, (file, file_len), Qnil);
-               sf = sf_open(file, SFM_READ, sfinfo);
+               if ( file != NULL ) {
+                       sf = sf_open(file, SFM_READ, sfinfo);
+               }
                break;
        }
        case MKIND_STRING: {