diff options
author | jbj <devnull@localhost> | 1999-09-21 03:22:53 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-09-21 03:22:53 +0000 |
commit | 20d78e939aa218e85ef19013769494851d863f13 (patch) | |
tree | 9fddb9815dafcdd8e7eb20bb4ec9fe3a80270b39 /build/expression.c | |
parent | 78ce864c5eee9b2d4fc3a3a4a201818f4e500d50 (diff) | |
download | librpm-tizen-20d78e939aa218e85ef19013769494851d863f13.tar.gz librpm-tizen-20d78e939aa218e85ef19013769494851d863f13.tar.bz2 librpm-tizen-20d78e939aa218e85ef19013769494851d863f13.zip |
fix: command line install had header memory leak.
check for NULL on all memory allocations.
free rpmrc mallocs on exit.
permit run time leak detection.
CVS patchset: 3311
CVS date: 1999/09/21 03:22:53
Diffstat (limited to 'build/expression.c')
-rw-r--r-- | build/expression.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/build/expression.c b/build/expression.c index e4b0601a9..1b053d4ec 100644 --- a/build/expression.c +++ b/build/expression.c @@ -43,7 +43,7 @@ static Value valueMakeInteger(int i) { Value v; - v = (Value) malloc(sizeof(struct _value)); + v = (Value) xmalloc(sizeof(struct _value)); v->type = VALUE_TYPE_INTEGER; v->data.i = i; return v; @@ -53,9 +53,9 @@ static Value valueMakeString(const char *s) { Value v; - v = (Value) malloc(sizeof(struct _value)); + v = (Value) xmalloc(sizeof(struct _value)); v->type = VALUE_TYPE_STRING; - v->data.s = strdup(s); + v->data.s = xstrdup(s); return v; } @@ -473,7 +473,7 @@ static Value doAddSubtract(ParseState state) return NULL; } - copy = malloc(strlen(v1->data.s) + strlen(v2->data.s) + 1); + copy = xmalloc(strlen(v1->data.s) + strlen(v2->data.s) + 1); strcpy(copy, v1->data.s); strcat(copy, v2->data.s); @@ -628,7 +628,7 @@ int parseExpressionBoolean(Spec spec, char *expr) DEBUG(printf("parseExprBoolean(?, '%s')\n", expr)); /* Initialize the expression parser state. */ - state.str = state.p = strdup(expr); + state.str = state.p = xstrdup(expr); state.spec = spec; rdToken(&state); @@ -673,7 +673,7 @@ char * parseExpressionString(Spec spec, char *expr) DEBUG(printf("parseExprString(?, '%s')\n", expr)); /* Initialize the expression parser state. */ - state.str = state.p = strdup(expr); + state.str = state.p = xstrdup(expr); state.spec = spec; rdToken(&state); @@ -697,10 +697,10 @@ char * parseExpressionString(Spec spec, char *expr) case VALUE_TYPE_INTEGER: { char buf[128]; sprintf(buf, "%d", v->data.i); - result = strdup(buf); + result = xstrdup(buf); } break; case VALUE_TYPE_STRING: - result = strdup(v->data.s); + result = xstrdup(v->data.s); break; default: break; |