]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/smartall.c
ebl add sql_escape to catalog messages
[bacula/bacula] / bacula / src / lib / smartall.c
index 7fe164f96c695a4675d08fac69f5287df6a0fca4..5ad10e539a9f5ae88c24adf1fdeb29b26bb9c3b3 100644 (file)
@@ -188,8 +188,10 @@ void sm_free(const char *file, int line, void *fp)
       V(mutex);
       Emsg2(M_ABORT, 0, _("Buffer overrun called from %s:%d\n"), file, line);
    }
-   sm_buffers--;
-   sm_bytes -= head->ablen;
+   if (sm_buffers > 0) {
+      sm_buffers--;
+      sm_bytes -= head->ablen;
+   }
 
    qdchain(qp);
    V(mutex);
@@ -283,8 +285,8 @@ void *sm_realloc(const char *fname, int lineno, void *ptr, unsigned int size)
       return NULL from  realloc()  and  leave  the  buffer  in  PTR
       intact.  */
 
-   sm_buffers--;
-   sm_bytes -= head->ablen;
+// sm_buffers--;
+// sm_bytes -= head->ablen;
 
    if ((buf = smalloc(fname, lineno, size)) != NULL) {
       memcpy(buf, ptr, (int) sm_min(size, osize));