aboutsummaryrefslogtreecommitdiff
path: root/src/DatabaseCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-07 23:37:38 +0200
committerMax Kellermann <max@duempel.org>2012-08-07 23:45:00 +0200
commit8855efebc0488555b5a985589ee1f070c352c687 (patch)
treea94dc07f5b1a446e4cdf311afb8aefd11e0e2b71 /src/DatabaseCommands.cxx
parent7725577a5347958de47476f4659c74094d18de32 (diff)
locate: don't allow empty list
Diffstat (limited to 'src/DatabaseCommands.cxx')
-rw-r--r--src/DatabaseCommands.cxx30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/DatabaseCommands.cxx b/src/DatabaseCommands.cxx
index dc2b9fc1..6c6d8965 100644
--- a/src/DatabaseCommands.cxx
+++ b/src/DatabaseCommands.cxx
@@ -62,10 +62,7 @@ handle_find(struct client *client, int argc, char *argv[])
struct locate_item_list *list =
locate_item_list_parse(argv + 1, argc - 1, false);
- if (list == NULL || list->length == 0) {
- if (list != NULL)
- locate_item_list_free(list);
-
+ if (list == NULL) {
command_error(client, ACK_ERROR_ARG, "incorrect arguments");
return COMMAND_RETURN_ERROR;
}
@@ -85,10 +82,7 @@ handle_findadd(struct client *client, int argc, char *argv[])
{
struct locate_item_list *list =
locate_item_list_parse(argv + 1, argc - 1, false);
- if (list == NULL || list->length == 0) {
- if (list != NULL)
- locate_item_list_free(list);
-
+ if (list == NULL) {
command_error(client, ACK_ERROR_ARG, "incorrect arguments");
return COMMAND_RETURN_ERROR;
}
@@ -110,10 +104,7 @@ handle_search(struct client *client, int argc, char *argv[])
struct locate_item_list *list =
locate_item_list_parse(argv + 1, argc - 1, true);
- if (list == NULL || list->length == 0) {
- if (list != NULL)
- locate_item_list_free(list);
-
+ if (list == NULL) {
command_error(client, ACK_ERROR_ARG, "incorrect arguments");
return COMMAND_RETURN_ERROR;
}
@@ -134,10 +125,7 @@ handle_searchadd(struct client *client, int argc, char *argv[])
struct locate_item_list *list =
locate_item_list_parse(argv + 1, argc - 1, true);
- if (list == NULL || list->length == 0) {
- if (list != NULL)
- locate_item_list_free(list);
-
+ if (list == NULL) {
command_error(client, ACK_ERROR_ARG, "incorrect arguments");
return COMMAND_RETURN_ERROR;
}
@@ -161,10 +149,7 @@ handle_searchaddpl(struct client *client, int argc, char *argv[])
struct locate_item_list *list =
locate_item_list_parse(argv + 2, argc - 2, true);
- if (list == NULL || list->length == 0) {
- if (list != NULL)
- locate_item_list_free(list);
-
+ if (list == NULL) {
command_error(client, ACK_ERROR_ARG, "incorrect arguments");
return COMMAND_RETURN_ERROR;
}
@@ -186,10 +171,7 @@ handle_count(struct client *client, int argc, char *argv[])
struct locate_item_list *list =
locate_item_list_parse(argv + 1, argc - 1, false);
- if (list == NULL || list->length == 0) {
- if (list != NULL)
- locate_item_list_free(list);
-
+ if (list == NULL) {
command_error(client, ACK_ERROR_ARG, "incorrect arguments");
return COMMAND_RETURN_ERROR;
}