]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
defrag tests: fix compiler warnings
authorVictor Julien <victor@inliniac.net>
Thu, 24 Sep 2015 10:24:15 +0000 (12:24 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 8 Oct 2015 08:35:45 +0000 (10:35 +0200)
defrag.c:2423:9: error: variable 'p' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2460:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2423:5: note: remove the 'if' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2423:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2460:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2423:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2423:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~
defrag.c:2460:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2423:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~
defrag.c:2427:5: note: variable 'p' is declared here
    Packet *p = Defrag(NULL, NULL, p1, NULL);
    ^
defrag.c:2486:9: error: variable 'p' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2523:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2486:5: note: remove the 'if' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2486:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2523:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2486:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2486:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~
defrag.c:2523:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2486:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~
defrag.c:2490:5: note: variable 'p' is declared here
    Packet *p = Defrag(NULL, NULL, p1, NULL);
    ^
6 errors generated.
make[3]: *** [defrag.o] Error 1

src/defrag.c

index 956fe7ded4da7a23e869fa464c7e76102e787dd5..1d86c44868bf5912674143b013e7b59664fd3ddd 100644 (file)
@@ -2414,6 +2414,7 @@ static int DefragMfIpv4Test(void)
 {
     int retval = 0;
     int ip_id = 9;
+    Packet *p = NULL;
 
     DefragInit();
 
@@ -2424,7 +2425,7 @@ static int DefragMfIpv4Test(void)
         goto end;
     }
 
-    Packet *p = Defrag(NULL, NULL, p1, NULL);
+    p = Defrag(NULL, NULL, p1, NULL);
     if (p != NULL) {
         goto end;
     }
@@ -2477,6 +2478,7 @@ static int DefragMfIpv6Test(void)
 {
     int retval = 0;
     int ip_id = 9;
+    Packet *p = NULL;
 
     DefragInit();
 
@@ -2487,7 +2489,7 @@ static int DefragMfIpv6Test(void)
         goto end;
     }
 
-    Packet *p = Defrag(NULL, NULL, p1, NULL);
+    p = Defrag(NULL, NULL, p1, NULL);
     if (p != NULL) {
         goto end;
     }