From dcbd3f995a9b502565e232d577ab8045dd26b1df Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Mon, 28 May 2007 11:53:30 +0000 Subject: [PATCH] - fix memory leak - attempt evaluate_to_expr after evaluate_to_string failed - returns nested classads correctly - still does not work for expressions (are evaluated to "undefined") --- org.glite.jp.primary/src/classad_plugin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/org.glite.jp.primary/src/classad_plugin.c b/org.glite.jp.primary/src/classad_plugin.c index 6bd8328..1d7b6ec 100644 --- a/org.glite.jp.primary/src/classad_plugin.c +++ b/org.glite.jp.primary/src/classad_plugin.c @@ -176,13 +176,17 @@ static int classad_query(void *fpctx,void *handle, const char *attr,glite_jp_att return glite_jp_stack_error(ctx,&err); } - if (cclassad_evaluate_to_string(h->ad, strrchr(attr, ':')+1, &str)) { + if (!cclassad_evaluate_to_string(h->ad, strrchr(attr, ':')+1, &str) && + cclassad_evaluate_to_expr(h->ad, strrchr(attr, ':')+1, &str) && + !strcasecmp(str,"undefined")) { free(str); str = NULL; } + + if (str) { //struct stat fattr; /*XXX ignore error */ //glite_jppsbe_file_attrs(ctx, h->bhandle, &fattr); av = calloc(2, sizeof(glite_jp_attrval_t)); av[0].name = strdup(attr); - av[0].value = strdup(str); + av[0].value = str; str = NULL; av[0].size = -1; av[0].timestamp = h->timestamp; av[0].origin = GLITE_JP_ATTR_ORIG_FILE; -- 1.8.2.3