From 8e71111cf765430aed3e603c73c284d44d603d17 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 10 Apr 2010 12:20:14 +0200 Subject: [PATCH] Revert "Lets fix calling INGfreeDescriptor before INGfreeINGresult as INGfreeINGresult free the whole INGresult struct" This reverts commit 35235b8647eae94a46db9d60d99344ee560c570b. --- bacula/src/cats/myingres.c | 9 +++------ bacula/src/cats/myingres.sc | 8 +++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/bacula/src/cats/myingres.c b/bacula/src/cats/myingres.c index 29cf2f2623..227464b0ee 100644 --- a/bacula/src/cats/myingres.c +++ b/bacula/src/cats/myingres.c @@ -272,6 +272,7 @@ static void INGfreeINGresult(INGresult *ing_res) free(ing_res->fields); } free(ing_res); + ing_res = NULL; } static inline ING_ROW *INGgetRowSpace(INGresult *ing_res) { @@ -522,20 +523,16 @@ INGresult *INGquery(B_DB *mdb, INGconn *conn, const char *query) if (!desc) { return NULL; } - res = INGgetINGresult(desc); if (!res) { return NULL; } - rows = INGfetchAll(query, res); - if (rows < 0) { - INGfreeDescriptor(desc); INGfreeINGresult(res); + INGfreeDescriptor(desc); return NULL; } - return res; } void INGclear(INGresult *res) @@ -543,8 +540,8 @@ void INGclear(INGresult *res) if (res == NULL) { return; } - INGfreeDescriptor(res->sqlda); INGfreeINGresult(res); + INGfreeDescriptor(res->sqlda); } INGconn *INGconnectDB(char *dbname, char *user, char *passwd) { diff --git a/bacula/src/cats/myingres.sc b/bacula/src/cats/myingres.sc index e065313f4f..2ea172a5a6 100644 --- a/bacula/src/cats/myingres.sc +++ b/bacula/src/cats/myingres.sc @@ -297,6 +297,7 @@ static void INGfreeINGresult(INGresult *ing_res) free(ing_res->fields); } free(ing_res); + ing_res = NULL; } static inline ING_ROW *INGgetRowSpace(INGresult *ing_res) @@ -551,20 +552,17 @@ INGresult *INGquery(B_DB *mdb, INGconn *conn, const char *query) if (!desc) { return NULL; } - res = INGgetINGresult(desc); if (!res) { return NULL; } - rows = INGfetchAll(query, res); if (rows < 0) { - INGfreeDescriptor(desc); INGfreeINGresult(res); + INGfreeDescriptor(desc); return NULL; } - return res; } @@ -574,8 +572,8 @@ void INGclear(INGresult *res) return; } - INGfreeDescriptor(res->sqlda); INGfreeINGresult(res); + INGfreeDescriptor(res->sqlda); } INGconn *INGconnectDB(char *dbname, char *user, char *passwd) -- 2.39.5