Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /tivo_commands.c [ba75f2] .. [cd20aa] Maximize Restore

  Switch to side-by-side view

--- a/tivo_commands.c
+++ b/tivo_commands.c
@@ -394,7 +394,7 @@
 	}
 	else
 	{
-		item = sql_get_text_field(db, "SELECT NAME from OBJECTS where OBJECT_ID = '%s'", objectID);
+		item = sql_get_text_field(db, "SELECT NAME from OBJECTS where OBJECT_ID = '%q'", objectID);
 		if( item )
 		{
 			title = escape_tag(item, 1);
@@ -406,12 +406,12 @@
 
 	if( recurse )
 	{
-		xasprintf(&which, "OBJECT_ID glob '%s$*'", objectID);
+		which = sqlite3_mprintf("OBJECT_ID glob '%q$*'", objectID);
 		strcpy(groupBy, "group by DETAIL_ID");
 	}
 	else
 	{
-		xasprintf(&which, "PARENT_ID = '%s'", objectID);
+		which = sqlite3_mprintf("PARENT_ID = '%q'", objectID);
 	}
 
 	if( sortOrder )
@@ -631,8 +631,8 @@
 		DPRINTF(E_ERROR, L_HTTP, "SQL error: %s\n", zErrMsg);
 		sqlite3_free(zErrMsg);
 		Send500(h);
+		sqlite3_free(which);
 		free(title);
-		free(which);
 		free(resp);
 		return;
 	}
@@ -653,7 +653,7 @@
 	memcpy(str.data, &str_buf, ret);
 	str.size = str.off+ret;
 	free(title);
-	free(which);
+	sqlite3_free(which);
 	BuildResp_upnphttp(h, str.data, str.size);
 	free(resp);
 	SendResp_upnphttp(h);
@@ -763,7 +763,8 @@
 			}
 			else
 			{
-				SendContainer(h, container, itemStart, itemCount, anchorItem, anchorOffset, recurse, sortOrder, filter, randomSeed);
+				SendContainer(h, container, itemStart, itemCount, anchorItem,
+				              anchorOffset, recurse, sortOrder, filter, randomSeed);
 			}
 		}
 		else if( strcmp(command, "QueryItem") == 0 )