]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_pgsql,mod_mariadb] Fix scan-build warnings. 434/head
authorAndrey Volk <andywolk@gmail.com>
Tue, 25 Feb 2020 21:48:40 +0000 (01:48 +0400)
committerAndrey Volk <andywolk@gmail.com>
Tue, 25 Feb 2020 21:48:40 +0000 (01:48 +0400)
src/mod/databases/mod_mariadb/mod_mariadb.c
src/mod/databases/mod_pgsql/mod_pgsql.c

index 05151d4c890a3f647c793b47efbd5aec28c7b5cf..cdd64ffb81d80e67d438503753c724227f8f2f43 100644 (file)
@@ -685,15 +685,10 @@ error:
        err_str = mariadb_handle_get_error(handle);
 
        if (zstr(err_str)) {
-               if (zstr(er)) {
-                       err_str = strdup((char *)"SQL ERROR!");
-               } else {
-                       err_str = er;
-               }
+               switch_safe_free(err_str);
+               err_str = (er) ? er : strdup((char *)"SQL ERROR!");
        } else {
-               if (!zstr(er)) {
-                       free(er);
-               }
+               switch_safe_free(er);
        }
 
        if (err_str) {
index b69d54f497321f6a69f02aa5ad17f04c9f7cc804..a534594548e281831ba8f03a812176aca4c2a109 100644 (file)
@@ -565,7 +565,9 @@ switch_status_t database_handle_exec_string(switch_database_interface_handle_t *
                goto error;
        }
 
-       if (result) {
+       if (!result) {
+               goto done;
+       } else {
                switch (result->status) {
 #if POSTGRESQL_MAJOR_VERSION >= 9 && POSTGRESQL_MINOR_VERSION >= 2
                case PGRES_SINGLE_TUPLE: