// Fill in playlist metadata
// Use the Filename as the playlist name, dropping the ".spl" extension
pl->name = malloc(sizeof(char)*(strlen(oi->Filename) -4 +1));
+ if (pl->name == NULL) {
+ LIBMTP_ERROR("pl->name malloc failed");
+ return;
+ }
+
memcpy(pl->name, oi->Filename, strlen(oi->Filename) -4);
// Set terminating character
pl->name[strlen(oi->Filename) - 4] = 0;
// FIXME add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Playlist: Could not get .spl playlist file.");
close(fd);
LIBMTP_INFO("FIXME closed\n");
+ return;
}
text_t* p = read_into_spl_text_t(device, fd);
// create the file object for storing
LIBMTP_file_t* f = malloc(sizeof(LIBMTP_file_t));
+ if (f == NULL) {
+ LIBMTP_ERROR("f malloc failed");
+ return -1;
+ }
f->item_id = 0;
f->parent_id = pl->parent_id;
f->storage_id = pl->storage_id;
*/
static void append_text_t(text_t** t, char* s)
{
+ if (s == NULL)
+ return;
+
if(*t == NULL) {
*t = malloc(sizeof(text_t));
+
+ if (*t == NULL)
+ return;
}
else {
(*t)->next = malloc(sizeof(text_t));
+
+ if ((*t)->next == NULL)
+ return;
+
(*t) = (*t)->next;
}
(*t)->text = strdup(s);