From d0059fa2611c9db88dd365b77ce49c04d2102de3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Sat, 3 Sep 2011 12:44:11 +0000 Subject: [PATCH] Fixed memory issue (patch submitted by Lekensteyn). Added help for -s option. --- NEWS | 4 ++++ src/lp_ws.c | 17 +++++++++-------- src/main.c | 5 +++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index c3c953a..7ff7df5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +* v0.0.4 +** Fixed memory issue (patch submitted by Lekensteyn). +** Added help for -s option. + * v0.0.3 ** Generated HTML pages for package versions. ** Added distro/arch information in package version page. diff --git a/src/lp_ws.c b/src/lp_ws.c index 6c2e299..d6f4087 100644 --- a/src/lp_ws.c +++ b/src/lp_ws.c @@ -121,23 +121,24 @@ json_object_to_binary_package_publishing_history_list struct binary_package_publishing_history * * get_binary_package_publishing_history_list(const char *archive_url, - const char *package_status) + const char *pkg_status) { struct json_object *o_next; - char *url = malloc(strlen(archive_url)+ - strlen(QUERY_GET_PUBLISHED_BINARIES)+ - strlen("&status=")+ - 9+ - 1); + char *url; json_object *o; void **result = NULL; + url = malloc(strlen(archive_url)+ + strlen(QUERY_GET_PUBLISHED_BINARIES)+ + (pkg_status ? strlen("&status=")+strlen(pkg_status) : 0)+ + 1); + strcpy(url, archive_url); strcat(url, QUERY_GET_PUBLISHED_BINARIES); - if (package_status) { + if (pkg_status) { strcat(url, "&status="); - strcat(url, package_status); + strcat(url, pkg_status); } while (url) { diff --git a/src/main.c b/src/main.c index f7b615a..2314f81 100644 --- a/src/main.c +++ b/src/main.c @@ -125,6 +125,11 @@ static void print_help() -o, --output_dir=[PATH] \ generates HTML pages into 'PATH'."); + puts("\ + -s, --status=[STATUS] retrieves only package of the given status\n\ + (possible values are: Pending, Published, \n\ + Superseded, Deleted or Obsolete)."); + puts(""); printf("Report bugs to: %s\n", PACKAGE_BUGREPORT); -- 2.7.4