From 0303f15fa4eba6e63135c1642d516b19cff0a85b Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Fri, 10 Apr 2009 22:25:04 +0000 Subject: [PATCH] * Fix segfault when encountering a certain type of corrupted embedded JPEG image on audio files. --- albumart.c | 2 ++ minidlna.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/albumart.c b/albumart.c index aa35f7d..a797fd1 100644 --- a/albumart.c +++ b/albumart.c @@ -126,6 +126,8 @@ check_embedded_art(const char * path, const char * image_data, int image_size) } imsrc = image_new_from_jpeg(NULL, 0, image_data, image_size); + if( !imsrc ) + return NULL; width = imsrc->width; height = imsrc->height; diff --git a/minidlna.c b/minidlna.c index 3d16ab6..16e280a 100644 --- a/minidlna.c +++ b/minidlna.c @@ -653,10 +653,14 @@ main(int argc, char * * argv) { DPRINTF(E_FATAL, L_GENERAL, "ERROR: Failed to create sqlite database! Exiting...\n"); } + #if USE_FORK if( pthread_create(&thread[0], NULL, start_scanner, NULL) ) { DPRINTF(E_FATAL, L_GENERAL, "ERROR: pthread_create() failed for start_scanner.\n"); } + #else + start_scanner(); + #endif } sqlite3_free_table(result); }