--- src/plugins/rhbz.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c index a3aa2ef..2e7d62c 100644 --- a/src/plugins/rhbz.c +++ b/src/plugins/rhbz.c @@ -88,20 +88,19 @@ static char *trim_all_whitespace(const char *str)
int is_comment_dup(GList *comments, const char *comment) { - for (GList *l = comments; l; l = l->next) + char * const trim_comment = trim_all_whitespace(comment); + bool same_comments = false; + + for (GList *l = comments; l && !same_comments; l = l->next) { - char *comment_body = (char *) l->data; - char *trim_comment_body = trim_all_whitespace(comment_body); - char *trim_comment = trim_all_whitespace(comment); - if (!strcmp(trim_comment_body, trim_comment)) - { - free(trim_comment_body); - free(trim_comment); - return 1; - } + const char * const comment_body = (const char *) l->data; + char * const trim_comment_body = trim_all_whitespace(comment_body); + same_comments = !strcmp(trim_comment_body, trim_comment); + free(trim_comment_body); }
- return 0;; + free(trim_comment); + return same_comments; }
static unsigned find_best_bt_rating_in_comments(GList *comments)
--- src/plugins/reporter-bugzilla.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c index 6584f0f..39f356a 100644 --- a/src/plugins/reporter-bugzilla.c +++ b/src/plugins/reporter-bugzilla.c @@ -16,6 +16,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include <locale.h> #include "internal_libreport.h" #include "client.h" #include "abrt_xmlrpc.h"
Jakub Filak jfilak@redhat.com writes:
src/plugins/reporter-bugzilla.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c index 6584f0f..39f356a 100644 --- a/src/plugins/reporter-bugzilla.c +++ b/src/plugins/reporter-bugzilla.c @@ -16,6 +16,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include <locale.h> #include "internal_libreport.h" #include "client.h" #include "abrt_xmlrpc.h"
ok, push and please use $ git commit -s
On Monday, April 16, 2012 01:08:59 PM Nikola Pajkovsky wrote:
Jakub Filak jfilak@redhat.com writes:
src/plugins/reporter-bugzilla.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c index 6584f0f..39f356a 100644 --- a/src/plugins/reporter-bugzilla.c +++ b/src/plugins/reporter-bugzilla.c @@ -16,6 +16,7 @@
with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <locale.h>
#include "internal_libreport.h" #include "client.h" #include "abrt_xmlrpc.h"
ok, push and please use $ git commit -s
I'm sorry, but I've realized that this patch is wrong because #include locale.h should be surrounded with condition on HAVE_LOCALE_H.
I'm about to fix it.
Regards Jakub
Jakub Filak jfilak@redhat.com writes:
src/plugins/rhbz.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c index a3aa2ef..2e7d62c 100644 --- a/src/plugins/rhbz.c +++ b/src/plugins/rhbz.c @@ -88,20 +88,19 @@ static char *trim_all_whitespace(const char *str)
int is_comment_dup(GList *comments, const char *comment) {
- for (GList *l = comments; l; l = l->next)
- char * const trim_comment = trim_all_whitespace(comment);
- bool same_comments = false;
- for (GList *l = comments; l && !same_comments; l = l->next) {
char *comment_body = (char *) l->data;
char *trim_comment_body = trim_all_whitespace(comment_body);
char *trim_comment = trim_all_whitespace(comment);
if (!strcmp(trim_comment_body, trim_comment))
{
free(trim_comment_body);
free(trim_comment);
return 1;
}
const char * const comment_body = (const char *) l->data;
char * const trim_comment_body = trim_all_whitespace(comment_body);
same_comments = !strcmp(trim_comment_body, trim_comment);
}free(trim_comment_body);
- return 0;;
- free(trim_comment);
- return same_comments;
}
static unsigned find_best_bt_rating_in_comments(GList *comments)
pointless patch
we are leaking on many other places, but it's alright, beacuse it's not long running process. Kernel always cleans all memory when process exits.
On 04/16/2012 01:08 PM, Nikola Pajkovsky wrote:
Jakub Filakjfilak@redhat.com writes:
src/plugins/rhbz.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c index a3aa2ef..2e7d62c 100644 --- a/src/plugins/rhbz.c +++ b/src/plugins/rhbz.c @@ -88,20 +88,19 @@ static char *trim_all_whitespace(const char *str)
int is_comment_dup(GList *comments, const char *comment) {
- for (GList *l = comments; l; l = l->next)
- char * const trim_comment = trim_all_whitespace(comment);
- bool same_comments = false;
- for (GList *l = comments; l&& !same_comments; l = l->next) {
char *comment_body = (char *) l->data;
char *trim_comment_body = trim_all_whitespace(comment_body);
char *trim_comment = trim_all_whitespace(comment);
if (!strcmp(trim_comment_body, trim_comment))
{
free(trim_comment_body);
free(trim_comment);
return 1;
}
const char * const comment_body = (const char *) l->data;
char * const trim_comment_body = trim_all_whitespace(comment_body);
same_comments = !strcmp(trim_comment_body, trim_comment);
free(trim_comment_body); }
- return 0;;
free(trim_comment);
return same_comments; }
static unsigned find_best_bt_rating_in_comments(GList *comments)
pointless patch
we are leaking on many other places, but it's alright, beacuse it's not long running process. Kernel always cleans all memory when process exits.
- this patch is not pointless, since our code is scanned by coverity we need to adjust to it otherwise we will be getting complains - which means we need to fix the mem leaks in the old code and not introduce memleaks in the new code
- Ack
crash-catcher@lists.fedorahosted.org