diff options
author | Linus Walleij <triad@df.lth.se> | 2010-09-18 11:28:56 +0000 |
---|---|---|
committer | Linus Walleij <triad@df.lth.se> | 2010-09-18 11:28:56 +0000 |
commit | cdc1209154677ee939c0c22656ee2338d926a79b (patch) | |
tree | 7bb186077ea8a58036823ef3ae194dc26775554c | |
parent | 8d97badc0b8ab19b08ed4dcd76ffee52ef3bd0aa (diff) | |
download | libmtp-cdc1209154677ee939c0c22656ee2338d926a79b.tar.gz |
NULL check on abstract lists
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/libmtp.c | 10 |
2 files changed, 13 insertions, 2 deletions
@@ -1,3 +1,8 @@ +2010-09-18 Linus Walleij <triad@df.lth.se> + + * src/libmtp.c: NULL check on abstract lists, drop unused + folder variable. + 2010-07-25 Linus Walleij <triad@df.lth.se> * src/libmtp.c: if the Ogg or FLAC filetypes have been diff --git a/src/libmtp.c b/src/libmtp.c index 513efc6..ffeb082 100644 --- a/src/libmtp.c +++ b/src/libmtp.c @@ -6710,7 +6710,7 @@ static LIBMTP_folder_t *get_subfolders_for_folder(LIBMTP_folder_t *list, uint32_ LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t *device) { PTPParams *params = (PTPParams *) device->params; - LIBMTP_folder_t head, *folders, *rv; + LIBMTP_folder_t head, *rv; int i; // Get all the handles if we haven't already done that @@ -7112,6 +7112,12 @@ static int create_new_abstract_list(LIBMTP_mtpdevice_t *device, char fname[256]; uint8_t data[2]; + // NULL check + if (!name) { + add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): list name was NULL, using default name \"Unknown\""); + return -1; + } + if (storageid == 0) { // I'm just guessing that an abstract list may require 512 bytes store = get_writeable_storageid(device, 512); @@ -7127,7 +7133,7 @@ static int create_new_abstract_list(LIBMTP_mtpdevice_t *device, } } if (!supported) { - add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): player does not support this abstract type."); + add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): player does not support this abstract type"); LIBMTP_ERROR("Unsupported abstract list type: %04x\n", objectformat); return -1; } |