]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Fix memory leak when using testsolv to execute cases 499/head
authorbanjiuqingshan <63209634+banjiuqingshan@users.noreply.github.com>
Sat, 18 Jun 2022 17:43:51 +0000 (01:43 +0800)
committerGitHub <noreply@github.com>
Sat, 18 Jun 2022 17:43:51 +0000 (01:43 +0800)
*resultp will only keep the pointer of the last cycle, which will lead to memory leakage.
This solves the first memory leak problem in issue #496 "==255147==error..."

ext/testcase.c

index 035cfdbd116cb8d8f84b1e706c8f3ae64d2bcfe5..c529057a8f02a61e1534d995fb615863f5188cc4 100644 (file)
@@ -2448,7 +2448,10 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
                }
            }
          if (resultp)
+         {
+           solv_free(*resultp);
            *resultp = result;
+         }
          else
            solv_free(result);
          if (resultflagsp)